home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1995 May / cd Ware (Juegos) Epimundo.iso / DOS / C / LITECOM.ZIP / LC6.DOC < prev    next >
Encoding:
Text File  |  1991-08-25  |  148.2 KB  |  4,078 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           OVERVIEW .
  8.                      
  9.                     ..
  10.                       .
  11.                        .
  12.                         .
  13.                          .
  14.                           .
  15.                            .
  16.                             .
  17.                               
  18.                              . 
  19.                               . 
  20.                                . 
  21.                                 ..
  22.                                    
  23.                                   . 
  24.                                    . 
  25.                                     . 
  26.                                      . 
  27.                                       . 
  28.                                        . 
  29.                                         . 
  30.                                          . 
  31.                                           . 
  32.                                            . 
  33.                                             . 
  34.                                              . 
  35.                                               . 
  36.                                                . 
  37.                                                 ..
  38.                                                   .
  39.                                                    .
  40.                                                     .
  41.                                                      .
  42.                                                       .
  43.                                                        .
  44.                                                         .
  45.                                                          .
  46.                                                           .
  47.                                                            .
  48.                                                             .
  49.                                                              .
  50.                                                               .
  51.                                                                .
  52.                                                                 .
  53.                                                                  .
  54.                                                                   .
  55.                                                                    .
  56.                                                                     .
  57.                                                                       
  58.                                                                      . 
  59.                                                                       ..
  60.                                                                         .
  61.                                                                          .
  62.                                                                           .
  63.                                                                             1
  64.  
  65.             INTRODUCTION   
  66.                           . 
  67.                            . 
  68.                             . 
  69.                              . 
  70.                               . 
  71.                                . 
  72.                                 . 
  73.                                  . 
  74.                                   . 
  75.                                    . 
  76.                                     . 
  77.                                      ..
  78.                                        .
  79.                                         .
  80.                                          .
  81.                                           .
  82.                                            .
  83.                                             .
  84.                                              .
  85.                                               .
  86.                                                .
  87.                                                 .
  88.                                                  .
  89.                                                   .
  90.                                                    .
  91.                                                     .
  92.                                                      .
  93.                                                       .
  94.                                                        .
  95.                                                         .
  96.                                                          .
  97.                                                           .
  98.                                                            .
  99.                                                             .
  100.                                                              .
  101.                                                               .
  102.                                                                .
  103.                                                                 .
  104.                                                                  .
  105.                                                                   .
  106.                                                                    .
  107.                                                                     .
  108.                                                                      .
  109.                                                                       .
  110.                                                                        .
  111.                                                                         .
  112.                                                                          .
  113.                                                                           .
  114.                                                                             1
  115.  
  116.  
  117.             What is Shareware   
  118.                                . 
  119.                                 . 
  120.                                  . 
  121.                                   . 
  122.                                    . 
  123.                                     . 
  124.                                      . 
  125.                                       . 
  126.                                        . 
  127.                                         . 
  128.                                          . 
  129.                                           . 
  130.                                            . 
  131.                                             . 
  132.                                              . 
  133.                                               . 
  134.                                                . 
  135.                                                 . 
  136.                                                  . 
  137.                                                   . 
  138.                                                    . 
  139.                                                     . 
  140.                                                      . 
  141.                                                       . 
  142.                                                        . 
  143.                                                         . 
  144.                                                          . 
  145.                                                           . 
  146.                                                            . 
  147.                                                             . 
  148.                                                              . 
  149.                                                               . 
  150.                                                                . 
  151.                                                                 . 
  152.                                                                  . 
  153.                                                                   . 
  154.                                                                    . 
  155.                                                                     . 
  156.                                                                      . 
  157.                                                                       ..
  158.                                                                         .
  159.                                                                          .
  160.                                                                           .
  161.                                                                             1
  162.  
  163.             LICENSE, WARRANTY AND REGISTRATION  .
  164.                                                  .
  165.                                                   .
  166.                                                    .
  167.                                                     .
  168.                                                      .
  169.                                                       .
  170.                                                        .
  171.                                                         .
  172.                                                          .
  173.                                                           .
  174.                                                            .
  175.                                                             .
  176.                                                              .
  177.                                                               .
  178.                                                                .
  179.                                                                 .
  180.                                                                  .
  181.                                                                   .
  182.                                                                    .
  183.                                                                     .
  184.                                                                      .
  185.                                                                       .
  186.                                                                        .
  187.                                                                         .
  188.                                                                          .
  189.                                                                           .
  190.                                                                             2
  191.  
  192.                LICENSE .
  193.                         .
  194.                          .
  195.                           .
  196.                            .
  197.                             .
  198.                              .
  199.                               .
  200.                                .
  201.                                 .
  202.                                  .
  203.                                   .
  204.                                    .
  205.                                     .
  206.                                      .
  207.                                       .
  208.                                        .
  209.                                         .
  210.                                          .
  211.                                           .
  212.                                            .
  213.                                             .
  214.                                              .
  215.                                               .
  216.                                                .
  217.                                                 .
  218.                                                  .
  219.                                                   .
  220.                                                    .
  221.                                                     .
  222.                                                      .
  223.                                                       .
  224.                                                        .
  225.                                                         .
  226.                                                          .
  227.                                                           .
  228.                                                            .
  229.                                                             .
  230.                                                              .
  231.                                                               .
  232.                                                                .
  233.                                                                 .
  234.                                                                  .
  235.                                                                   .
  236.                                                                    .
  237.                                                                     .
  238.                                                                      .
  239.                                                                       .
  240.                                                                        .
  241.                                                                         .
  242.                                                                          .
  243.                                                                           .
  244.                                                                             2
  245.  
  246.  
  247.                WARRANTY  
  248.                         . 
  249.                          . 
  250.                           . 
  251.                            . 
  252.                             . 
  253.                              . 
  254.                               . 
  255.                                . 
  256.                                 . 
  257.                                  . 
  258.                                   . 
  259.                                    . 
  260.                                     . 
  261.                                      . 
  262.                                       . 
  263.                                        . 
  264.                                         . 
  265.                                          . 
  266.                                           . 
  267.                                            . 
  268.                                             . 
  269.                                              . 
  270.                                               . 
  271.                                                . 
  272.                                                 . 
  273.                                                  . 
  274.                                                   . 
  275.                                                    . 
  276.                                                     . 
  277.                                                      . 
  278.                                                       . 
  279.                                                        . 
  280.                                                         . 
  281.                                                          . 
  282.                                                           . 
  283.                                                            . 
  284.                                                             . 
  285.                                                              . 
  286.                                                               . 
  287.                                                                . 
  288.                                                                 . 
  289.                                                                  . 
  290.                                                                   . 
  291.                                                                    ..
  292.                                                                      .
  293.                                                                       .
  294.                                                                        .
  295.                                                                         .
  296.                                                                          .
  297.                                                                           .
  298.                                                                             2
  299.  
  300.                REGISTRATION .
  301.                              .
  302.                               .
  303.                                .
  304.                                 .
  305.                                  .
  306.                                   .
  307.                                    .
  308.                                      
  309.                                     ..
  310.                                       .
  311.                                        .
  312.                                         .
  313.                                          .
  314.                                           .
  315.                                            .
  316.                                              
  317.                                             ..
  318.                                               .
  319.                                                .
  320.                                                  
  321.                                                 ..
  322.                                                   .
  323.                                                    .
  324.                                                      
  325.                                                     ..
  326.                                                       .
  327.                                                        .
  328.                                                         .
  329.                                                          .
  330.                                                           .
  331.                                                            .
  332.                                                              
  333.                                                             ..
  334.                                                               .
  335.                                                                .
  336.                                                                  
  337.                                                                 ..
  338.                                                                   .
  339.                                                                    .
  340.                                                                      
  341.                                                                     ..
  342.                                                                       .
  343.                                                                        .
  344.                                                                         .
  345.                                                                          .
  346.                                                                           .
  347.                                                                             2
  348.  
  349.                IS REGISTRATION WORTHWHILE? .
  350.                                             .
  351.                                              .
  352.                                               .
  353.                                                .
  354.                                                 .
  355.                                                  .
  356.                                                   .
  357.                                                    .
  358.                                                     .
  359.                                                      .
  360.                                                       .
  361.                                                        .
  362.                                                         .
  363.                                                          .
  364.                                                           .
  365.                                                            .
  366.                                                             .
  367.                                                              .
  368.                                                                
  369.                                                               ..
  370.                                                                 .
  371.                                                                  .
  372.                                                                    
  373.                                                                   ..
  374.                                                                     .
  375.                                                                      .
  376.                                                                        
  377.                                                                       ..
  378.                                                                         .
  379.                                                                           
  380.                                                                          ..
  381.                                                                             2
  382.  
  383.  
  384.           Serial Port Fundamentals .
  385.                                      
  386.                                     ..
  387.                                       .
  388.                                        .
  389.                                         .
  390.                                          .
  391.                                           .
  392.                                            .
  393.                                              
  394.                                             ..
  395.                                                
  396.                                               ..
  397.                                                  
  398.                                                 ..
  399.                                                   .
  400.                                                    .
  401.                                                     .
  402.                                                      .
  403.                                                       .
  404.                                                        .
  405.                                                         .
  406.                                                          .
  407.                                                           .
  408.                                                             
  409.                                                            ..
  410.                                                              .
  411.                                                               .
  412.                                                                 
  413.                                                                . 
  414.                                                                 ..
  415.                                                                   .
  416.                                                                     
  417.                                                                    . 
  418.                                                                     ..
  419.                                                                        
  420.                                                                       ..
  421.                                                                         .
  422.                                                                           
  423.                                                                          . 
  424.                                                                           . 3
  425.  
  426.             The 8250 UART family  .
  427.                                     
  428.                                    ..
  429.                                      .
  430.                                        
  431.                                       ..
  432.                                          
  433.                                         ..
  434.                                            
  435.                                           ..
  436.                                              
  437.                                             ..
  438.                                               .
  439.                                                .
  440.                                                  
  441.                                                 ..
  442.                                                    
  443.                                                   . 
  444.                                                    . 
  445.                                                     ..
  446.                                                        
  447.                                                       ..
  448.                                                          
  449.                                                         ..
  450.                                                            
  451.                                                           ..
  452.                                                              
  453.                                                             ..
  454.                                                               .
  455.                                                                .
  456.                                                                 .
  457.                                                                  .
  458.                                                                    
  459.                                                                   ..
  460.                                                                      
  461.                                                                     ..
  462.                                                                       .
  463.                                                                         
  464.                                                                        ..
  465.                                                                          .
  466.                                                                            
  467.                                                                           . 3
  468.  
  469.                Purpose of the port .
  470.                                     .
  471.                                      .
  472.                                        
  473.                                       ..
  474.                                         .
  475.                                          .
  476.                                           .
  477.                                            .
  478.                                             .
  479.                                               
  480.                                              ..
  481.                                                .
  482.                                                  
  483.                                                 ..
  484.                                                    
  485.                                                   ..
  486.                                                     .
  487.                                                      .
  488.                                                       .
  489.                                                         
  490.                                                        ..
  491.                                                           
  492.                                                          ..
  493.                                                            .
  494.                                                             .
  495.                                                              .
  496.                                                               .
  497.                                                                .
  498.                                                                 .
  499.                                                                   
  500.                                                                  ..
  501.                                                                    .
  502.                                                                     .
  503.                                                                      .
  504.                                                                       .
  505.                                                                        .
  506.                                                                          
  507.                                                                         ..
  508.                                                                           .
  509.                                                                             3
  510.  
  511.  
  512.             INTERNAL PORT DETAILS  .
  513.                                     .
  514.                                       
  515.                                      ..
  516.                                        .
  517.                                         .
  518.                                          .
  519.                                            
  520.                                           ..
  521.                                              
  522.                                             . 
  523.                                              . 
  524.                                               ..
  525.                                                  
  526.                                                 ..
  527.                                                   .
  528.                                                    .
  529.                                                      
  530.                                                     . 
  531.                                                      . 
  532.                                                       ..
  533.                                                          
  534.                                                         ..
  535.                                                           .
  536.                                                             
  537.                                                            . 
  538.                                                             . 
  539.                                                              . 
  540.                                                               ..
  541.                                                                  
  542.                                                                 . 
  543.                                                                  . 
  544.                                                                   ..
  545.                                                                      
  546.                                                                     . 
  547.                                                                      ..
  548.                                                                         
  549.                                                                        ..
  550.                                                                          .
  551.                                                                            
  552.                                                                           . 3
  553.  
  554.                The Interrupt Connection  
  555.                                         . 
  556.                                          . 
  557.                                           ..
  558.                                             .
  559.                                               
  560.                                              ..
  561.                                                .
  562.                                                 .
  563.                                                   
  564.                                                  . 
  565.                                                   ..
  566.                                                      
  567.                                                     . 
  568.                                                      . 
  569.                                                       . 
  570.                                                        ..
  571.                                                           
  572.                                                          . 
  573.                                                           . 
  574.                                                            . 
  575.                                                             ..
  576.                                                               .
  577.                                                                .
  578.                                                                 .
  579.                                                                   
  580.                                                                  ..
  581.                                                                     
  582.                                                                    . 
  583.                                                                     . 
  584.                                                                      . 
  585.                                                                       ..
  586.                                                                          
  587.                                                                         ..
  588.                                                                           .
  589.                                                                             4
  590.  
  591.  
  592.                THE PORT REGISTERS                  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.                                      LiteComm
  605.  
  606.  
  607.                               Communications ToolBox
  608.  
  609.  
  610.                               Copyright 1987 - 1991 
  611.  
  612.                            Information Technology, Ltd.
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.                              Information Technology
  638.  
  639.                                   5 Park Blvd.
  640.  
  641.                                Lincoln, RI 02865
  642.  
  643.                                  (401) 724-2730
  644.  
  645.  
  646.  
  647.  
  648.  
  649.                                       OVERVIEW
  650.  
  651.  
  652.  
  653.  
  654.        INTRODUCTION
  655.  
  656.  
  657.                                 TM
  658.  
  659.             The LiteComm ToolBox   is a set of powerful routines designed to
  660.  
  661.             provide easy access to the full capabilities of the PC's asynch-
  662.  
  663.             ronous communications ports. The LiteComm ToolBox provides
  664.  
  665.             interrupt-driven, buffered communications support on COM1 through
  666.  
  667.             COM4 simultaneously. Now you can quickly incorporate sophis-
  668.  
  669.             ticated communications support in your applications without hav-
  670.  
  671.             ing in-depth knowledge of how the hardware functions.
  672.  
  673.  
  674.             LiteComm is the result of meeting a need for communications in
  675.  
  676.             CAD/CAM applications created for a client company. Each version
  677.  
  678.             of the LiteComm ToolBox depends upon its respective host compil-
  679.  
  680.             er.
  681.  
  682.  
  683.  
  684.             The 'Lite' in LiteComm refers to the high granularity of the
  685.  
  686.             product. LiteComm, in simple applications, adds about 5K bytes of
  687.  
  688.             overhead. Yet it provides a highly reliable base on which to
  689.  
  690.             build.
  691.  
  692.  
  693.             As you use LiteComm, you will find yourself in good company. Li-
  694.  
  695.             teComm is currently in use at ATT, IBM, NASA, and the Associated
  696.  
  697.             Press, to name a few of our users. In addition, LiteComm has been
  698.  
  699.             featured in at least one book, Straight Talk by Charles Bowen and
  700.  
  701.             Stewart Schneider. Finally, the Turbo Pascal version of LiteComm
  702.  
  703.             is the basis for the Async Professional package from Turbopower
  704.  
  705.             Software.
  706.  
  707.  
  708.  
  709.        What is Shareware
  710.  
  711.             Shareware is a "try before you buy" means of software distribu-
  712.  
  713.             tion. If you find a shareware product useful, pay the registra-
  714.  
  715.             tion fee, and let the authors know that you support their
  716.  
  717.             efforts.
  718.  
  719.  
  720.  
  721.             Information Technology is a member of the Association of Share-
  722.  
  723.             ware Professionals (ASP).  ASP wants to make sure that the
  724.  
  725.             shareware principle works for you.  If you are unable to resolve
  726.  
  727.             a shareware-related problem with an ASP member by contacting the
  728.  
  729.             member directly, ASP may be able to help.  The ASP Ombudsman can
  730.  
  731.             help you resolve a dispute or problem with an ASP member, but
  732.  
  733.             does not provide technical support for members' products.  Please
  734.  
  735.             write to the ASP Ombudsman at P.O.  Box 5786, Bellevue, WA 98006
  736.  
  737.             or send a Compuserve message via easyplex to ASP Ombudsman
  738.  
  739.             70007,3536. 
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.                                             1
  747.  
  748.  
  749.  
  750.  
  751.  
  752.        LICENSE, WARRANTY AND REGISTRATION
  753.  
  754.             LICENSE
  755.  
  756.             Information regarding the LiteComm license will be found in the
  757.  
  758.             file LICENSE.DOC, on the distribution diskette. Please read this
  759.  
  760.             information. By your use of LiteComm, we assume that you agree to
  761.  
  762.             the terms and conditions of the license agreement.
  763.  
  764.  
  765.  
  766.             If you are interested in a site license for LiteComm, please see
  767.  
  768.             the file SITELICE.DOC on the distribution disk.
  769.  
  770.  
  771.             WARRANTY
  772.  
  773.  
  774.             The LiteComm warranty is in the distributed file WARRANTY.DOC. Be
  775.             sure you read the  warranty before using LiteComm.
  776.  
  777.  
  778.  
  779.             REGISTRATION
  780.  
  781.             Registration information and an order form are in the file
  782.  
  783.             REGISTER.DOC.
  784.  
  785.  
  786.  
  787.             IS REGISTRATION WORTHWHILE?
  788.  
  789.             LiteComm is a package undergoing continuing development.  We are
  790.  
  791.             constantly reviewing the product to make it smaller, faster, more
  792.  
  793.             reliable, and easier to use.  Since its introduction in mid 1987,
  794.  
  795.             we have made significant changes to the LiteComm kernel, the
  796.  
  797.             heart of the ToolBox, to improve efficiency and reliability.  We
  798.  
  799.             have also delivered to registered users protocol engines, LXM -
  800.  
  801.             the Xmodem engine, which supports Xmodem and Xmodem-1K; and LWXM
  802.  
  803.             -  the Windowed Xmodem engine.  We also provide a version of the
  804.  
  805.             Compuserve QUICKB protocol, specially adapted for use with the
  806.  
  807.             LiteComm ToolBox.
  808.  
  809.  
  810.  
  811.             We are also reviewing other protocol engine implementations. In
  812.  
  813.             this release of LiteComm, for example, we have added support for
  814.  
  815.             True YModem and ZModem. The small model library, as enhanced will
  816.  
  817.             always be offered as a shareware product.
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.                                             2
  839.  
  840.  
  841.  
  842.  
  843.  
  844.                               Serial Port Fundamentals
  845.  
  846.  
  847.  
  848.  
  849.        The 8250 UART family
  850.  
  851.  
  852.             This portion of the manual provides you with some details about
  853.             the working of the 8250 (and related) UART'S, the basic component
  854.  
  855.             of your system's serial port.  Some close compatibles use en-
  856.  
  857.             hanced versions of this chip, such as the 16450 and 16550.
  858.  
  859.             LiteComm works successfully with such devices.  If you have
  860.  
  861.             questions about the type of serial port you are using, refer to
  862.  
  863.             the manufacturer's documentation.  If your serial port does not
  864.  
  865.             use an 8250 or similar chip, LiteComm will not function.
  866.  
  867.  
  868.  
  869.             Purpose of the port
  870.  
  871.             The serial port converts information from the form in which it is
  872.  
  873.             used within your system, to a form that can be easily used out-
  874.  
  875.             side your system.  Modern computers, by design, are parallel in
  876.  
  877.             nature.  By this we mean that information travels through the
  878.  
  879.             computer's circuitry as whole units or as multiples of whole
  880.  
  881.             units. In the IBM PC and related systems, information travels as
  882.  
  883.             bytes (8 bits at a time), as words (16 bits at a time), or, on
  884.  
  885.             80386 and 80486 based systems, as double words (32 bits at a
  886.  
  887.             time).
  888.  
  889.  
  890.  
  891.             Within the computer, such arrangements are convenient and fast.
  892.  
  893.             When the computer must transfer information to an external de-
  894.  
  895.             vice, data path width is a problem.  To provide a parallel path
  896.  
  897.             between the computer and external devices, there would have to be
  898.  
  899.             enough data lines or circuits between the two to satisfy the data
  900.  
  901.             path.  For most modern computer systems, this would mean a mini-
  902.  
  903.             mum of 8 data lines, not counting any additional control
  904.  
  905.             information that also might be necessary.  For certain newer
  906.  
  907.             systems, the requirement might be for as many as 32 data lines.
  908.  
  909.             In effect, it might be necessary to have several different ver-
  910.  
  911.             sions of a device, dependent upon the data path width of the
  912.  
  913.             computer.
  914.  
  915.  
  916.             The purpose of a serial port is to convert the information from
  917.  
  918.             its internal, parallel form, to a more common, external form and
  919.  
  920.             back.  By using such an approach, we simplify the interconnection
  921.  
  922.             of devices, reducing information to its lowest common denomina-
  923.  
  924.             tor, the bit. It allows us to transfer information 1 bit at a
  925.  
  926.             time, using a single data path, between devices. The real beauty
  927.  
  928.             of this approach is that, by agreeing on how this external form
  929.  
  930.             appears, each device can hide the details of how it works, and
  931.  
  932.             still do the required task.
  933.  
  934.  
  935.  
  936.        INTERNAL PORT DETAILS
  937.  
  938.             In this section we discuss the fundamental working of serial
  939.  
  940.             ports on the IBM PC and close compatible systems.  It is not es-
  941.  
  942.             sential that you understand this material thoroughly to be
  943.  
  944.             successful with LiteComm. Still, it may help to answer some more
  945.  
  946.  
  947.                                             3
  948.  
  949.  
  950.  
  951.  
  952.  
  953.             important questions that may arise as you proceed with your de-
  954.  
  955.             velopment.
  956.  
  957.  
  958.             The Interrupt Connection
  959.  
  960.             The PC is an interrupt driven system. This is a sophisticated way
  961.  
  962.             of saying that the PC can pay attention to several internal de-
  963.  
  964.             vices. It doesn't have to check on, or poll, them periodically.
  965.  
  966.  
  967.  
  968.             The method by which 80x86 family interrupts work is elegant in
  969.  
  970.             its simplicity.  When a device needs the attention of the system,
  971.  
  972.             its asserts a control signal and identifies itself with a number
  973.  
  974.             ranging from 0 to 255. On the basic PC, the numbers used range
  975.  
  976.             from 8 through 15 decimal.  PC components translate the
  977.  
  978.             identification to a memory location by multiplying the identifi-
  979.  
  980.             cation by 4. The system then simulates a special form of a call
  981.  
  982.             to the routine whose address is at that memory location.  Since
  983.  
  984.             it is impossible to predict when a device will require attention,
  985.  
  986.             the system uses the far address of the routine, both segment and
  987.  
  988.             offset, therefore the 4.
  989.  
  990.  
  991.             Once called, this routine, called the Interrupt Service Routine
  992.  
  993.             or ISR, has a duty to save the state of the system when the in-
  994.  
  995.             terrupt occurred. It must take care of the interrupt as quickly
  996.  
  997.             as possible, and return control to the interrupted process.  It
  998.  
  999.             also must be aware that, while it is doing its work, other, more
  1000.  
  1001.             important devices may require attention, too.
  1002.  
  1003.  
  1004.  
  1005.             One device that requires constant attention is the system clock
  1006.  
  1007.             that ticks roughly 18 times per second.  In part, the PC makes
  1008.  
  1009.             provision for this by prioritizing the interrupt scheme.  The ISR
  1010.  
  1011.             must allow for this by reenabling the interrupt control system as
  1012.  
  1013.             rapidly as it is practical to do so.  The PC's interrupt struc-
  1014.  
  1015.             ture, if left undisturbed, will prevent interrupts of the same or
  1016.  
  1017.             lower priority from occurring. To help you organize your
  1018.  
  1019.             thoughts, the standard identifications for the first two serial
  1020.  
  1021.             ports on the system are 12 (0C) and 11 (0B) for ports 1 and 2
  1022.  
  1023.             respectively.
  1024.  
  1025.  
  1026.             However, the intrreupt structure of the PC is far from perfect.
  1027.  
  1028.             Systems that use the original ISA buss have a shortcoming. Only
  1029.  
  1030.             one device is allowed to occupy an interrupt vector or location
  1031.  
  1032.             at a time. This is in contrast to systems that employ either the
  1033.  
  1034.             micro-channel buss or the EISA buss. In these latter two buss
  1035.  
  1036.             designs, multiple devices may occupy a single intterupt location.
  1037.  
  1038.  
  1039.  
  1040.             As you can see, dealing with the PC's interrupt structure is not
  1041.  
  1042.             for the faint of heart.  It requires a significant amount of
  1043.  
  1044.             knowledge, and close attention to detail.  LiteComm takes care of
  1045.  
  1046.             these details for you.  You are free to focus on your applica-
  1047.  
  1048.             tion, treating the serial port in much the same way that you
  1049.  
  1050.             would any DOS file.
  1051.  
  1052.  
  1053.  
  1054.  
  1055.                                             4
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.             THE PORT REGISTERS
  1062.  
  1063.             The 8250 port is fully programmable.  LiteComm has already taken
  1064.  
  1065.             care of the intricacies of this programming. But some additional
  1066.  
  1067.             information about each register used in the serial port may be of
  1068.  
  1069.             use when you are attempting to communicate with an external de-
  1070.  
  1071.             vice. For the sake of this discussion, we use the basic register
  1072.  
  1073.             numbers. The actual register number used is the register number
  1074.  
  1075.             referenced below used as an offset to a base port number. For
  1076.  
  1077.             COM1 (port 1), this base is 3F8(hexadecimal).
  1078.  
  1079.  
  1080.  
  1081.             register 0 - transmit/receive
  1082.             register 0 - transmit/receive
  1083.             register 0 - transmit/receive
  1084.  
  1085.             In normal operation, the ISR reads individual characters from
  1086.  
  1087.             register 0 when the become available. The ISR writes to register
  1088.  
  1089.             0 when the transmitter portion of the 8250 is ready to accept a
  1090.  
  1091.             character.
  1092.  
  1093.  
  1094.             register 0 - baud rate selection
  1095.             register 0 - baud rate selection
  1096.             register 0 - baud rate selection
  1097.  
  1098.  
  1099.             During initialization, register 0 is part of the mechanism that
  1100.             sets baud rate.  During this process, register 0 and its compan-
  1101.  
  1102.             ion register 1 specify the baud rate divisor (not the actual baud
  1103.  
  1104.             rate). The baud rate divisor is a value that, when divided into a
  1105.  
  1106.             given, preset constant, yields the desired baud rate.  To set the
  1107.  
  1108.             baud rate, you must first enable access to this mode. This is
  1109.  
  1110.             done by writing a value of 80H to register 3, the line control
  1111.  
  1112.             register.  Once complete, the least significant byte (LSB) of the
  1113.  
  1114.             divisor is written to register 0; the most significant byte is
  1115.  
  1116.             written to register 1.  Access to the normal modes of registers 0
  1117.  
  1118.             and 1 are reenabled by writing any value less than 80H to the
  1119.  
  1120.             line control register.  Of course, only certain values less than
  1121.  
  1122.             80H would be meaningful (see the line control register descrip-
  1123.  
  1124.             tion below).
  1125.  
  1126.  
  1127.  
  1128.             register 1 - interrupt enable
  1129.             register 1 - interrupt enable
  1130.             register 1 - interrupt enable
  1131.  
  1132.             Values written to register 1 control the conditions that will
  1133.  
  1134.             cause the 8250 to interrupt the system. There are four possible
  1135.  
  1136.             conditions that can cause interrupts:
  1137.  
  1138.  
  1139.  
  1140.             1. A character has been received (RDI)
  1141.                                              (RDI)
  1142.                                              (RDI)
  1143.  
  1144.             2. The transmitter is ready to send a character (TDI)
  1145.                                                             (TDI)
  1146.                                                             (TDI)
  1147.  
  1148.             3. An error or BREAK signal has been detected (ERI)
  1149.                                                           (ERI)
  1150.                                                           (ERI)
  1151.  
  1152.  
  1153.             4. A modem status  signal has changed (MSI)
  1154.                                                   (MSI)
  1155.                                                   (MSI)
  1156.  
  1157.  
  1158.             The designations, in parentheses, are for our purposes only. They
  1159.  
  1160.             are not 'standard' designations. To enable a particular type of
  1161.  
  1162.             interrupt, you must set the corresponding bit in a byte to a 1,
  1163.  
  1164.             then write the byte to register 1.  To reset (ignore) the condi-
  1165.  
  1166.             tion, set the corresponding bit to 0.  The diagram that follows
  1167.  
  1168.             shows the bit positions the correspond to the various conditions
  1169.  
  1170.             described above.
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.                                             5
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.                 N/A    N/A    N/A    N/A   Modem  Error/  Xmit   Recv
  1183.  
  1184.                                            Status Break  Ready   Char
  1185.  
  1186.                  7      6      5      4      3      2      1      0
  1187.  
  1188.             Register 1 Bit Definitions
  1189.  
  1190.  
  1191.  
  1192.             register 1 - baud rate selection
  1193.             register 1 - baud rate selection
  1194.             register 1 - baud rate selection
  1195.  
  1196.  
  1197.             See the description under register 0, baud rate selection.
  1198.  
  1199.  
  1200.  
  1201.             register 2 - interrupt identification
  1202.             register 2 - interrupt identification
  1203.             register 2 - interrupt identification
  1204.  
  1205.  
  1206.             Register 2, in normal operation, acts as a companion to register
  1207.  
  1208.             1.  Register 1 determines the conditions that can cause an
  1209.  
  1210.             interrupt.  Register 2 identifies the specific condition that
  1211.  
  1212.             caused the interrupt, when more than one condition is enabled.
  1213.  
  1214.             The least significant 3 bits of the register contain the identi-
  1215.  
  1216.             fication.  See the diagram of register 2 that follows.
  1217.  
  1218.  
  1219.  
  1220.                 N/A    N/A    N/A    N/A    N/A   Int ID Int ID  Int
  1221.  
  1222.                                                                  Pend
  1223.  
  1224.                  7      6      5      4      3      2      1      0
  1225.  
  1226.             Register 2 Bit Definitions
  1227.  
  1228.  
  1229.  
  1230.             Since it is possible, even likely, that more than one condition
  1231.  
  1232.             may occur simultaneously, bit 0 tells whether all conditions that
  1233.  
  1234.             currently exist have been handled.  When bit 0 has a value of 0
  1235.  
  1236.             (yes zero), there are conditions waiting to be handled.  When bit
  1237.  
  1238.             0 has a value of 1, all outstanding conditions have been handled.
  1239.  
  1240.             Bits 2 and 1 taken together identify the actual cause of the in-
  1241.  
  1242.             terrupt.
  1243.  
  1244.  
  1245.             Again, because of the multiple conditions that may occur, the
  1246.  
  1247.             8250 presents the conditions in a prioritized order.  When bits 2
  1248.  
  1249.             and 1 have a value of 3 (the most important), an ERI
  1250.                                                              ERI
  1251.                                                              ERI condition
  1252.  
  1253.             exists. The actual error can be read from the line status regis-
  1254.  
  1255.             ter(register 5). Reading this register also clears the condition.
  1256.  
  1257.  
  1258.  
  1259.             When a value of 2 is present, an RDI 
  1260.                                              RDI 
  1261.                                              RDI condition has occurred, and
  1262.  
  1263.             a character should be read from port 0. If the character is not
  1264.  
  1265.             read quickly enough, a data overrun error may occur, indicating
  1266.  
  1267.             the loss of a character.
  1268.  
  1269.  
  1270.             When bits 2 and 1 have a value of 1, a TDI 
  1271.                                                    TDI 
  1272.                                                    TDI condition has occurred
  1273.  
  1274.             and a character may be written to register 0.
  1275.  
  1276.  
  1277.  
  1278.             A value of zero in bits 2 and 1(least important) shows that one
  1279.  
  1280.             or more of the modem status lines (so called) have changed. The
  1281.  
  1282.             condition can be cleared by reading the contents of the modem
  1283.  
  1284.             status register, register 6.
  1285.  
  1286.  
  1287.  
  1288.                                             6
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.             register 3 - line control
  1295.             register 3 - line control
  1296.             register 3 - line control
  1297.  
  1298.             The line control register gives the means for setting those val-
  1299.  
  1300.             ues that affect the way in which the serial port appears to the
  1301.  
  1302.             outside world.  It is through this register that the program es-
  1303.  
  1304.             tablishes character length, parity, and other significant values.
  1305.  
  1306.             Indirectly, register 3 also plays a role in setting the speed
  1307.  
  1308.             (baud rate) of the port. (See the description of registers 0 and
  1309.  
  1310.             1.)
  1311.  
  1312.  
  1313.  
  1314.                Baud   Send   Force Parity  Enable  Stop   Char   Char
  1315.  
  1316.                 Div   Break Parity  Type   Parity  Bits   Len    Len
  1317.  
  1318.                  7      6      5      4      3      2      1      0
  1319.  
  1320.             Register 3 Bit Definitions
  1321.  
  1322.  
  1323.  
  1324.  
  1325.             register 4 - modem control
  1326.             register 4 - modem control
  1327.             register 4 - modem control
  1328.  
  1329.             The modem control register permits control of the two modem- re-
  1330.  
  1331.             lated signals that the serial port generates as an output.  The
  1332.  
  1333.             signals are Request To Send, RTS
  1334.                                          RTS
  1335.                                          RTS and Data Terminal Ready, DTR
  1336.                                                                       DTR
  1337.                                                                       DTR.
  1338.  
  1339.  
  1340.  
  1341.             These two signals are handshaking signals, since they, in part,
  1342.  
  1343.             help a connected device figure out the state of the connection.
  1344.  
  1345.             These signals were originally designated to be used in a specific
  1346.  
  1347.             fashion. Yet, manufacturers of specific devices have used them to
  1348.  
  1349.             meet their needs. Your success or failure in dealing with any
  1350.  
  1351.             specific device may depend, in part, on your understanding of how
  1352.  
  1353.             the device's manufacturer uses these signals. LiteComm provides
  1354.  
  1355.             you the means for manipulating these signals in a variety of
  1356.  
  1357.             ways.
  1358.  
  1359.  
  1360.             You will notice in the register 4 diagram, below that some addi-
  1361.  
  1362.             tional positions are identified.
  1363.  
  1364.  
  1365.  
  1366.                 N/A    N/A    N/A  Enable   OUT2   OUT1   RTS    DTR
  1367.  
  1368.                                     Loop   (reqd)
  1369.  
  1370.                  7      6      5      4      3      2      1      0
  1371.  
  1372.             Register 4 Bit Definitions
  1373.  
  1374.  
  1375.  
  1376.             LiteComm controls these additional positions for your benefit.
  1377.  
  1378.             Only one deserves mention, the position labeled OUT2
  1379.                                                             OUT2
  1380.                                                             OUT2.  It is
  1381.  
  1382.             necessary for this position to have a value of 1 for the serial
  1383.  
  1384.             port to function as an interrupting device. Since LiteComm relies
  1385.  
  1386.             on interrupts to perform it's job, it always sets this position
  1387.  
  1388.             correctly.
  1389.  
  1390.  
  1391.             register 5 - line status
  1392.             register 5 - line status
  1393.             register 5 - line status
  1394.  
  1395.  
  1396.             The program normally reads the line status register when an ERI
  1397.                                                                         ERI
  1398.                                                                         ERI
  1399.  
  1400.             condition occurs.  Each bit of the character returned has sig-
  1401.  
  1402.             nificance, as shown in the accompanying diagram. Using the ap-
  1403.  
  1404.             propriate functions in LiteComm, you can interrogate the value in
  1405.  
  1406.             this register, and test for the various conditions using the
  1407.  
  1408.                                             7
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.             LiteComm- provided definitions. Note that, due to the special
  1415.  
  1416.             nature of the BREAK
  1417.                           BREAK
  1418.                           BREAK signal, LiteComm treats this one condition as
  1419.  
  1420.             a separate entity.
  1421.  
  1422.  
  1423.                Time   Shift  Hold   Recd   Frame  Parity  Over   Data
  1424.  
  1425.                 Out    Reg    Reg   Break  Error  Error   Run   Rec'd
  1426.  
  1427.                       Empty  Empty                       Error
  1428.  
  1429.                  7      6      5      4      3      2      1      0
  1430.  
  1431.  
  1432.             Register 5 Bit Definitions
  1433.  
  1434.  
  1435.             register 6 - modem status
  1436.             register 6 - modem status
  1437.             register 6 - modem status
  1438.  
  1439.  
  1440.             Just as the serial port can generate certain handshaking signals,
  1441.  
  1442.             it also can read, and report on the status of similar signals
  1443.  
  1444.             that an external device generates.  In their original form, these
  1445.  
  1446.             signals had special significance for connections between a
  1447.  
  1448.             terminal and a modem. We refer you to our comments, above, about
  1449.  
  1450.             present day use of the handshaking signals.
  1451.  
  1452.  
  1453.             One special note is appropriate here.  The modem status register
  1454.  
  1455.             provides two types of information.  The most significant 4 bits
  1456.  
  1457.             (see the diagram) show the current state of the 4 covered sig-
  1458.  
  1459.             nals.  The least significant 4 bits show which, if any, of the
  1460.  
  1461.             signals have changed state (from zero to one, or vice-versa),
  1462.  
  1463.             since the last time the register was interrogated.  LiteComm up-
  1464.  
  1465.             dates its internal tables with this value in real-time, and re-
  1466.  
  1467.             ports the results when asked to do so.  You can test the signals
  1468.  
  1469.             individually or in combination using the LiteComm- provided
  1470.  
  1471.             definitions.
  1472.  
  1473.  
  1474.  
  1475.                 DCD    RI     DSR    CTS   Delta  Delta  Delta  Delta
  1476.  
  1477.                Carr   Ring   Data   Clear   DCD     RI    DSR    CTS
  1478.  
  1479.                 Det    Ind  Set Rd  Send
  1480.  
  1481.                  7      6      5      4      3      2      1      0
  1482.  
  1483.             Register 6 Bit Definitions
  1484.  
  1485.  
  1486.  
  1487.             The LiteComm Connection
  1488.  
  1489.             In the design of LiteComm, we have purposely 'hidden' many
  1490.  
  1491.             underlying details we presented above. Often, you will have
  1492.  
  1493.             little use for this additional information. This is particularly
  1494.  
  1495.             true of most of the applications with which you will come into
  1496.  
  1497.             contact.  In most applications, you probably will open the port
  1498.  
  1499.             or ports, set the necessary parameters and modem control signals,
  1500.  
  1501.             and do nothing more than read and write characters using one or
  1502.  
  1503.             more of the LiteComm functions.  The beauty of LiteComm's design
  1504.  
  1505.             is that its high degree of granularity doesn't force you to pay
  1506.  
  1507.             the price of dragging along functions that you are not using.
  1508.  
  1509.  
  1510.  
  1511.             The information that we presented above will help you when  it is
  1512.  
  1513.             necessary to communicate with a device that requires special
  1514.  
  1515.             handshaking considerations, such as a cash drawer.  You also may
  1516.  
  1517.             need the information we presented if you intend to use serial
  1518.  
  1519.             ports beyond COM2 (serial port 2).
  1520.  
  1521.                                             8
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.             Finally, by presenting the information that we have supplied, we
  1529.  
  1530.             hope to gain a more informed user.  Communications programming is
  1531.  
  1532.             not the black art that some would have you believe, although it
  1533.  
  1534.             can easily seem that way at times.  Of the calls we receive with
  1535.  
  1536.             questions, more than 75 per cent could be answered by the caller
  1537.  
  1538.             himself with a more thorough understanding of the underlying
  1539.  
  1540.             concepts and rules.
  1541.  
  1542.  
  1543.  
  1544.        ToolBox NOTES AND WARNINGS
  1545.  
  1546.  
  1547.             Note:
  1548.             Note:
  1549.             Note:Special warning for old-style PC owners
  1550.  
  1551.             There is a known problem with serial ports on older systems. Due
  1552.  
  1553.             to a problem with old-style 8250 and 16450 UARTS, it is possible
  1554.  
  1555.             for the  transmitter to stop functioning. This problem is cuased
  1556.  
  1557.             by a loss of interrupts under load. While software workarounds
  1558.  
  1559.             exist, we have decided not to include such workarounds in Lite-
  1560.  
  1561.             Comm. Inclusion of this logic would result in added overhead to
  1562.  
  1563.             all LiteComm users. If you believe you are experiencing this
  1564.  
  1565.             problem, please contact us.
  1566.  
  1567.  
  1568.  
  1569.             Note:
  1570.             Note:
  1571.             Note:Open Required
  1572.  
  1573.             Before you can send or receive information on a serial port using
  1574.  
  1575.             the ToolBox, you must use the open function to enable the line.
  1576.  
  1577.             This function initializes the UART with the correct parameters,
  1578.  
  1579.             and introduces the UART into the interrupt structure of the PC.
  1580.  
  1581.             The ToolBox will detect, and report, any errors that you may make
  1582.  
  1583.             in selecting the port or specifying the initial parameters. 
  1584.  
  1585.  
  1586.  
  1587.             Note:
  1588.             Note:
  1589.             Note:Close Required
  1590.  
  1591.             The ToolBox interfaces directly with the interrupt structure of
  1592.  
  1593.             the PC. It is critical before exiting a program that has opened a
  1594.  
  1595.             serial port that the serial port is closed with the close func-
  1596.  
  1597.             tion. Since it is possible for a program to terminate abnormally,
  1598.  
  1599.             the open function installs an exit routine that will
  1600.  
  1601.             automatically close any open ports.  Good programming practice
  1602.  
  1603.             demands that your program should close the ports explicitly.  By
  1604.  
  1605.             so doing, you may avoid problems in the future if we find it
  1606.  
  1607.             necessary to remove the auto-close functionality. Further, the
  1608.  
  1609.             auto-close functionality drops all modem handshaking signals ab-
  1610.  
  1611.             solutely, while an explicit close can decide whether to drop
  1612.  
  1613.             these signals. If you are unaware of exit functions, check your
  1614.  
  1615.             compiler's documentation for the atexit() function for a complete
  1616.  
  1617.             explanation. Review the description of the comm_close() function,
  1618.  
  1619.             as well.
  1620.  
  1621.  
  1622.             Failure of the open function can result from several causes, im-
  1623.  
  1624.             proper parameters to the open function, a non-existant serial
  1625.  
  1626.             port or insufficient memory. The memory is needed for the re-
  1627.  
  1628.             quested buffers and related control structures for the port.
  1629.  
  1630.             Memory for the transmit and receive buffers as well as the port
  1631.  
  1632.             control block is allocated from free memory. It is your
  1633.  
  1634.             responsibility to insure that adequate memory is available for
  1635.  
  1636.  
  1637.                                             9
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.             this purpose.  This requires no particular action on your part.
  1644.  
  1645.             If you use LiteComm in combination with other packages, the other
  1646.  
  1647.             packages may place specific restrictions on your use of free
  1648.  
  1649.             memory.
  1650.  
  1651.  
  1652.             Note:
  1653.             Note:
  1654.             Note:Handshaking Signals
  1655.  
  1656.             The ToolBox will, at your option, assert both the DTR and RTS
  1657.  
  1658.             signals when you open the port.  If you do not select this option
  1659.  
  1660.              you must use the lc_setmdm function to assert (raise) this sig-
  1661.  
  1662.             nal.  In addition, some modems and other devices may require you
  1663.  
  1664.             to assert either the DTR (Data Terminal Ready) or the RTS (Re-
  1665.  
  1666.             quest To Send) signal before they will respond to data.  Please
  1667.  
  1668.             note that the use of handshaking signals is HIGHLY hardware-
  1669.  
  1670.             dependant.  The ToolBox provides all the functionality necessary
  1671.  
  1672.             for you to implement almost any handshaking scheme that might be
  1673.  
  1674.             required.
  1675.  
  1676.  
  1677.  
  1678.             WARNING
  1679.             WARNING
  1680.             WARNING
  1681.  
  1682.             Due to the use of all available interrupt modes of the 8250, one
  1683.  
  1684.             user has discovered an unusual set of circumstances that can be
  1685.  
  1686.             troublesome.  If the 8250 chip detects an error condition, such
  1687.  
  1688.             as a parity error, framing error, or data overrun error, it
  1689.  
  1690.             causes an interrupt to which the ToolBox will respond.  If these
  1691.  
  1692.             errors occur frequently enough, the ToolBox code will spend too
  1693.  
  1694.             much time handling the errors, and lose characters, causing
  1695.  
  1696.             additional errors.  If you encounter a situation in which your
  1697.  
  1698.             application appears to behave erratically, especially at higher
  1699.  
  1700.             speeds, investigate the following table.
  1701.  
  1702.  
  1703.  
  1704.             Possible Error Conditions
  1705.  
  1706.                Is the cabling to the other device sound and solidly con-
  1707.  
  1708.                nected?
  1709.  
  1710.                Are any of the signals in the cable 'floating' or are they all
  1711.  
  1712.                properly terminated?
  1713.  
  1714.  
  1715.  
  1716.                Is the other device functioning properly? We have encountered
  1717.  
  1718.                situations in which a serial port on some devices tends to be
  1719.  
  1720.                sloppy in terms of voltage levels, bit timings, and similar
  1721.  
  1722.                problems.  Any, or all, these situations can cause the erratic
  1723.  
  1724.                operation to which we referred.
  1725.  
  1726.  
  1727.             WARNING
  1728.             WARNING
  1729.             WARNING
  1730.  
  1731.  
  1732.             Unless you are very familiar with the interrupt structure of the
  1733.  
  1734.             PC, do not attempt to manipulate the interrupt enable flag out-
  1735.  
  1736.             side the ToolBox. The ToolBox sets and clears the interrupt en-
  1737.  
  1738.             able flag at appropriate times and assumes that it has sole
  1739.  
  1740.             control over the flag.
  1741.  
  1742.  
  1743.             Note:
  1744.             Note:
  1745.             Note:Byte Alignment
  1746.  
  1747.             Unless otherwise specified, all library functions use byte
  1748.  
  1749.             structure alignment. This alignment results from the way in which
  1750.  
  1751.             the interrupt handler was developed in assembly language.
  1752.  
  1753.  
  1754.                                             10
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.        NEW IN VERSION 6.00
  1762.  
  1763.             In version 6.0, we have again improved on the assembly language
  1764.  
  1765.             interrupt handlers.  In addition, there have been significant
  1766.  
  1767.             changes in the supporting functions to tighten the code.  The
  1768.  
  1769.             result is smaller applications, often able to operate at higher
  1770.  
  1771.             baud rates.
  1772.  
  1773.  
  1774.  
  1775.             Other additions to LiteComm in version 6.0 include fully
  1776.  
  1777.             automatic flow control using either software or hardware. Both
  1778.  
  1779.             variants are programmer-configurable. This should simplify things
  1780.  
  1781.             for some users. 
  1782.  
  1783.  
  1784.             In version 6.0, LiteComm will attempt to insure that you are at-
  1785.  
  1786.             tempting to open a valid COM port. If LiteComm believes that the
  1787.  
  1788.             port is not valid, it will return an error from comm_opn. The
  1789.  
  1790.             addition of a global error variable should help in determining
  1791.  
  1792.             the source of the error. See the section on LiteComm functions
  1793.  
  1794.             for additional information.
  1795.  
  1796.  
  1797.  
  1798.             And we have addressed an area that we have always considered a
  1799.  
  1800.             LiteComm weakness. In previous versions of LiteComm, it was pos-
  1801.  
  1802.             sible to detect an receive error globally, yet not know when it
  1803.  
  1804.             occurred. With version 6.0, LiteComm now buffers errors in the
  1805.  
  1806.             same way that it buffers incoming characters. At your option, you
  1807.  
  1808.             can retrieve the error status associated with a character.
  1809.  
  1810.  
  1811.             There have been numerous, less significant additions to LiteComm,
  1812.  
  1813.             as well. Many are the result of user-feedback. Nearly all are
  1814.  
  1815.             aimed at making your job simpler.
  1816.  
  1817.  
  1818.        BEYOND COM2
  1819.  
  1820.             THE ToolBox METHODOLOGY
  1821.  
  1822.             In the design of the original PC, and in subsequent variations
  1823.  
  1824.             such as the PC/AT, there was only provision for two serial ports.
  1825.  
  1826.             Many manufacturers of add-in products, both serial ports and in-
  1827.  
  1828.             ternal modems have added the capability to support 1 or more
  1829.  
  1830.             additional ports beyond the COM2 limit. Generally, this can cause
  1831.  
  1832.             problems in the PC since there is no room in the interrupt re-
  1833.  
  1834.             quest scheme for additional levels of interrupts. There are no
  1835.  
  1836.             designated interrupt vector for other additional ports.
  1837.  
  1838.  
  1839.  
  1840.             The ToolBox approach to resolving these issues is to permit the
  1841.  
  1842.             programmer a degree of control over the parameters that govern
  1843.  
  1844.             the interrupt mechanism for COM3 and COM4. Specifically, these
  1845.  
  1846.             parameters are:
  1847.  
  1848.  
  1849.             1. The interrupt request (IRQ) bit that is used to mask the 8259
  1850.  
  1851.                interrupt controller.
  1852.  
  1853.  
  1854.             2. The interrupt vector number (not address) to which the port is
  1855.  
  1856.                attached.
  1857.  
  1858.  
  1859.  
  1860.                                             11
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.             3. The base i/o register for the port itself. Of course, it we
  1867.  
  1868.                assume that the port is an 8250 UART or compatible device.
  1869.  
  1870.                Again, the LiteComm ToolBox will not function with non-8250
  1871.  
  1872.                type devices.
  1873.  
  1874.  
  1875.             Before you attempt to use COM3 and/or COM4, you must figure out
  1876.  
  1877.             from the port's documentation, the appropriate values for these
  1878.  
  1879.             three parameters. As distributed, the ToolBox assumes the
  1880.  
  1881.             following:
  1882.  
  1883.  
  1884.  
  1885.  
  1886.                               Port         COM 3     COM 4
  1887.  
  1888.                              IRQ Bit         4         3
  1889.  
  1890.  
  1891.                              Vector         0CH       0BH
  1892.  
  1893.                           Base Register     3E8H      2E8H
  1894.  
  1895.  
  1896.  
  1897.             You may change any of these values by using the _portchg function
  1898.  
  1899.             described below, but only before you open the port with comm_opn.
  1900.  
  1901.             Once the port has been opened, _portchg is ineffective. _portchg
  1902.  
  1903.             will not work on COM1 or COM2.
  1904.  
  1905.  
  1906.             At present, LiteComm is not compatible with multiport boards such
  1907.  
  1908.             as the Digiboard.  The structure of these boards generally re-
  1909.  
  1910.             quires additional programming to be used effectively.  If you
  1911.  
  1912.             want to use such a board with LiteComm, please contact us
  1913.  
  1914.             directly for information on custom modifications to LiteComm.  We
  1915.  
  1916.             have performed such modifications for other LiteComm users.
  1917.  
  1918.  
  1919.  
  1920.             CAUTIONS
  1921.  
  1922.             There is an intimate relationship between the IRQ setting and its
  1923.  
  1924.             related interrupt vector. In the PC, this relationship is con-
  1925.  
  1926.             trolled, in part, by the 8259 interrupt controller that is set
  1927.  
  1928.             during BIOS initialization.
  1929.  
  1930.  
  1931.  
  1932.             In brief, the BIOS settings for the PC (and most close compa-
  1933.  
  1934.             tibles) establish IRQ0 as vector number 08h, and subsequent IRQ
  1935.  
  1936.             levels at increasing vector numbers. These vector numbers (or
  1937.  
  1938.             types in INTEL terms) act as a cpu- directed call table to loca-
  1939.  
  1940.             tions in the lowest 1K of system memory. We can alter how the
  1941.  
  1942.             system responds to a given interrupt by replacing or changing the
  1943.  
  1944.             values in the associated vector position to point to a routine
  1945.  
  1946.             that we supply.
  1947.  
  1948.             Judging from the questions asked by some users of LiteComm, there
  1949.  
  1950.             is evidently some misunderstanding about using ports beyond COM2,
  1951.  
  1952.             and how this all relates to your hardware. Before you can suc-
  1953.  
  1954.             cessfully use COM3 or COM4, you must consider the following:
  1955.  
  1956.                Does the hardware permit a change to the base port and/or the
  1957.  
  1958.                interrupt vector to which the port responds?  Some expansion
  1959.  
  1960.                cards will support changing one and not the other, causing po-
  1961.  
  1962.                tential hardware conflicts and lost data. 
  1963.  
  1964.  
  1965.  
  1966.                                             12
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.                Does the hardware permit  reassignment of the IRQ priority?
  1973.  
  1974.                Some expansion cards permit you to alter the IRQ priority,
  1975.  
  1976.                some won't. Briefly, from the previous discussion, any change
  1977.  
  1978.                to the IRQ priority must allow a corresponding change to the
  1979.  
  1980.                interrupt vector number. Without this capability, reprogram-
  1981.  
  1982.                ming of the 8259 chip would be required. 
  1983.  
  1984.                Many add-on cards permit this dual change simply by making a
  1985.  
  1986.                single switch or jumper setting. Unfortunately, the documenta-
  1987.  
  1988.                tion for these cards  generally assumes that you are aware of
  1989.  
  1990.                the dual nature of the IRQ vector relationship, and may leave
  1991.  
  1992.                you with the impression that you are changing one and not the
  1993.  
  1994.                other. In most circumstances, this is not so.
  1995.  
  1996.  
  1997.             The point to all this is that LiteComm can only provide as much
  1998.  
  1999.             support as the hardware permits, or is capable of responding to.
  2000.  
  2001.             If you wish to use other than the default base port, interrupt
  2002.  
  2003.             vector, or irq priority for COM3 or COM4, then your expansion
  2004.  
  2005.             card must be able to support the new values; in other words,
  2006.  
  2007.             these values are all hardware-provided, and are recognized by the
  2008.  
  2009.             LiteComm software. If your hardware does not permit changing a
  2010.  
  2011.             value, LiteComm cannot improve the situation.
  2012.  
  2013.  
  2014.  
  2015.             We should, at this point, add one final caution about how inter-
  2016.  
  2017.             rupt priorities function, and their relationship to the irq bit
  2018.  
  2019.             that you may select. The standard PC permits 8 interrupt priority
  2020.  
  2021.             levels. The PC-AT and later systems permit a total of 16 inter-
  2022.  
  2023.             rupt priority levels. Regardless of system type, the programmable
  2024.  
  2025.             timer has the highest priority; the parallel printer port has the
  2026.  
  2027.             lowest priority. When an interrupt occurs, the interrupt
  2028.  
  2029.             controller (8259 chip) masks out all other interrupts from the
  2030.  
  2031.             priority of the interrupting device and all lower priority de-
  2032.  
  2033.             vices. 
  2034.  
  2035.  
  2036.             As an aid to making COM3 and COM4 fit, LiteComm supports inter-
  2037.  
  2038.             rupt chaining for the COM3 and COM4 ports, on PS/2 and other mi-
  2039.  
  2040.             crochannel systems. If you use COM3 or COM4, when an interrupt
  2041.  
  2042.             occurs, the kernel will attempt to determine if the interrupt was
  2043.  
  2044.             caused by the supported port or from another source. Only the
  2045.  
  2046.             PS/2 and similar systems can reliably support interrupt chaining;
  2047.  
  2048.             it is NOT a restriction that we impose. The restriction lies in
  2049.  
  2050.             the design of the original PC and PC-AT buss structure.
  2051.  
  2052.  
  2053.  
  2054.             If the kernel determines that the supported port did not cause
  2055.  
  2056.             the interrupt, an automatic chain to the original interrupt han-
  2057.  
  2058.             dler for that interrupt level (IRQ level) will take place. This
  2059.  
  2060.             allows you to "patch in" or share the available interrupt vec-
  2061.  
  2062.             tors.
  2063.  
  2064.  
  2065.             If you intend to use other than the library-provided defaults, be
  2066.  
  2067.             sure that you understand the interrupt mechanism. The use of the
  2068.  
  2069.             automatic chaining described above can be particularly trouble-
  2070.  
  2071.             some under some circumstances, resulting in loss of interrupts
  2072.  
  2073.             and, potentially, a system crash.
  2074.  
  2075.  
  2076.  
  2077.                                             13
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.             Note:
  2084.             Note:
  2085.             Note:DO NOT 
  2086.                  DO NOT 
  2087.                  DO NOT attempt to mix the ToolBox functions with other
  2088.  
  2089.             seemingly- related functions (such as the serial port BIOS calls
  2090.  
  2091.             provided in both Turbo and Microsoft C).  At least two users have
  2092.  
  2093.             attempted to use only the receive portions of LiteComm, while
  2094.  
  2095.             resorting to the BIOS functions to send characters or adjust port
  2096.  
  2097.             parameters such as baud rate. The results, at best, have been
  2098.  
  2099.             failure of the user's application to function, and, at worst,
  2100.  
  2101.             total system lockup.  This mix of functions is NOT supported and
  2102.  
  2103.             must not be used.  If you attempt such a mix, we cannot help you.
  2104.  
  2105.  
  2106.             If you chose to share the interrupt vectors for COM1 or COM2, you
  2107.  
  2108.             must be certain to open COM1 (COM2) last.  The interrupt chaining
  2109.  
  2110.             mechanism only works with COM3 and COM4.  Failure to follow this
  2111.  
  2112.             caution will result in a total loss of function of COM3 (COM4).
  2113.  
  2114.             In addition, the ports should be opened in descending order of
  2115.  
  2116.             the planned baud rate, i.e. the faster port should be opened
  2117.  
  2118.             first, the slower port should be opened last.  Whenever possible
  2119.  
  2120.             or practical, you will obtain best results by using the same baud
  2121.  
  2122.             rate on both ports.
  2123.  
  2124.  
  2125.  
  2126.             One final caution is in order.  One or two users have attempted
  2127.  
  2128.             to trace through the interrupts as they occur using software
  2129.  
  2130.             based debuggers.  This is a risky proposition at best since most
  2131.  
  2132.             debuggers work by tapping into, and disturbing, the interrupt
  2133.  
  2134.             mechanism.  If you feel you must use a debugger, try to avoid the
  2135.  
  2136.             kernel routines of LiteComm, or use a hardware-based debugger
  2137.  
  2138.             such as Periscope.
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.                                             14
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.        INSTALLATION
  2176.  
  2177.  
  2178.  
  2179.        PACKAGE CONTENTS
  2180.  
  2181.             Your distribution diskette contains many files that are important
  2182.  
  2183.             to you. See the file PACKING.LST on the distribution disk for a
  2184.  
  2185.             list of the files that you should have received.
  2186.  
  2187.  
  2188.        INSTALLING LITECOMM
  2189.  
  2190.             LiteComm is installed with the INSTALL utility that we provide on
  2191.  
  2192.             the distribution diskette. To use this utility, follow the easy
  2193.  
  2194.             steps below:
  2195.  
  2196.  
  2197.  
  2198.             1. Make a copy of the distribution diskette before beginning.
  2199.  
  2200.             2. Insert the distribution diskette in your diskette drive.
  2201.  
  2202.             3. Make the distribution diskette the default drive by typing ei-
  2203.  
  2204.                ther A:<ENTER> or B:<ENTER>.
  2205.  
  2206.             4. Type the command
  2207.  
  2208.  
  2209.                  INSTALL<ENTER>.
  2210.  
  2211.  
  2212.             INSTALL will present you with a screen that specifies the in-
  2213.  
  2214.             stallation default values. You may freely edit them before pro-
  2215.  
  2216.             ceeding with the installation. Use the arrow keys to move between
  2217.  
  2218.             the various options. When you are satisfied with your responses,
  2219.  
  2220.             press the <PAGE-DOWN> key to proceed with installation.
  2221.  
  2222.  
  2223.  
  2224.             INSTALL will create several directories on the target disk drive.
  2225.  
  2226.             These directories do not have to exist before you start INSTALL.
  2227.  
  2228.             After copying the necessary files, INSTALL will decompress the
  2229.  
  2230.             files into their final form and clean up after itself.
  2231.  
  2232.             By default, install will create the following directories:
  2233.  
  2234.                             LITECOMM          Header Files
  2235.  
  2236.  
  2237.                           LITECOMM\LIB     PreBuilt Libraries
  2238.  
  2239.                          LITECOMM\SOURCE   Package Source Code
  2240.  
  2241.  
  2242.  
  2243.             If you prefer, of course, you may install LiteComm manually by
  2244.  
  2245.             copying all of the distributed EXE files to your destination
  2246.  
  2247.             disk. Then execute each to decompress it, with the exception of
  2248.  
  2249.             INSTALL. Finally, delete each of the EXE files to clean up your
  2250.  
  2251.             disk. They will no longer be needed.
  2252.  
  2253.        REBUILDING THE LIBRARIES
  2254.  
  2255.             We have provided you with the source code for LiteComm so that
  2256.  
  2257.             you may modify our product to meet special needs. We encourage
  2258.  
  2259.             you to use the provided MAKE files to accomplish this. They were
  2260.  
  2261.             used in constructing the libraries you have just installed and
  2262.  
  2263.             will make the task decidedly simpler.  the make files for Turbo C
  2264.  
  2265.             are TURBOCOMM.MAK and TLCP.MAK. The make files for Microsoft C
  2266.  
  2267.             are MSCCOMM.MAK and MLCP.MAK. 
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.                                             15
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.             We have had a report from one user that the make files are not
  2280.  
  2281.             compatible with the version of the make utility provided with the
  2282.  
  2283.             IBM C compiler, even though IBM's product is derived from Micro-
  2284.  
  2285.             soft C. Unfortunately, we do not support the IBM product as we
  2286.  
  2287.             have no way of assuring compatibility. We do understand, however,
  2288.  
  2289.             that the Microsoft libraries are fully compatible.
  2290.  
  2291.             GENERAL NOTES
  2292.  
  2293.             LiteComm and its related libraries make extensive use of parame-
  2294.  
  2295.             ters defined in the included header files. Your programs should
  2296.  
  2297.             always use the same header file parameters. While every effort
  2298.  
  2299.             will be made in future releases of LiteComm to preserve the val-
  2300.  
  2301.             ues as currently provided, we cannot guarantee that changes will
  2302.  
  2303.             never occur. The surest way to safeguard your efforts is to use
  2304.  
  2305.             the defined parameters. Then, when new versions of LiteComm are
  2306.  
  2307.             released, you need only recompile and relink to insure
  2308.  
  2309.             consistency.
  2310.  
  2311.  
  2312.  
  2313.             In the discussion of the various functions that follows, you
  2314.  
  2315.             should assume that any references to the port variable refer to a
  2316.  
  2317.             variable or constant that may take on a value of from 1 to 4. No
  2318.  
  2319.             other values are acceptable, and will be rejected.
  2320.  
  2321.  
  2322.             While we feel that LiteComm is written in the most efficient way
  2323.  
  2324.             possible, commensurate with good programming practice, we cannot
  2325.  
  2326.             be responsible for variations caused by hardware configurations
  2327.  
  2328.             or other factors beyond our control. LiteComm has been tested on
  2329.  
  2330.             the IBM PC-AT, IBM PS/2 and several compatible systems such as
  2331.  
  2332.             the Zenith and Wyse equivalents. LiteComm has not been tested in
  2333.  
  2334.             environments in which other software, most significantly TSR
  2335.  
  2336.             (terminate and stay resident) modules exist. Some TSR programs
  2337.  
  2338.             that "steal" interrupts for their purposes present an unfavorable
  2339.  
  2340.             environment to other programs that rely on the interrupt struc-
  2341.  
  2342.             ture of the computer.
  2343.  
  2344.  
  2345.  
  2346.             If you experience erratic behavior with LiteComm in a TSR-type
  2347.  
  2348.             situation, try executing your application without the TSR module
  2349.  
  2350.             being present. If the problems you have experienced disappear,
  2351.  
  2352.             suspect the TSR module.
  2353.  
  2354.  
  2355.             Conversely, LiteComm provides an excellent vehicle for supporting
  2356.  
  2357.             TSR programs that you may write. Since the package is fully
  2358.  
  2359.             reentrant, your only concern need be with those aspects of TSR
  2360.  
  2361.             programs are of normal concern, e.g., the non reentrant nature of
  2362.  
  2363.             DOS. 
  2364.  
  2365.             LiteComm only uses DOS functions when opening and closing ports.
  2366.  
  2367.             It may therefore be safely used in a TSR environment. As an
  2368.  
  2369.             example, we have included the program SPM as part of this re-
  2370.  
  2371.             lease.  SPM is a background Serial Port Monitor that is available
  2372.  
  2373.             as a separate shareware product. SPM was developed using Lite-
  2374.  
  2375.             Comm.
  2376.  
  2377.  
  2378.             USE WITH MULTITASKING ENVIRONMENTS
  2379.  
  2380.             Some users have made attempts at using LiteComm with multitasking
  2381.  
  2382.             environments such as Quarterdesk's DesqView.  Use of LiteComm in
  2383.  
  2384.  
  2385.                                             16
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.             such an environment is certain to be affected by the way in which
  2392.  
  2393.             the multitasking behaves with respect to interrupts.  We recog-
  2394.  
  2395.             nize that DesqView has achieved a great deal of popularity among
  2396.  
  2397.             so-called power users. Still, LiteComm was not explicitly de-
  2398.  
  2399.             signed for such environments, and its performance may suffer as a
  2400.  
  2401.             result.
  2402.  
  2403.             NOTES ON RING DETECTION
  2404.  
  2405.             Several users have reported problems in consistently detecting a
  2406.  
  2407.             ringing telephone by checking the state of the RI (Ring Indica-
  2408.  
  2409.             tor) signal.  The problem seems highly dependent on the type of
  2410.  
  2411.             modem that is being used, since this signal comes from the modem.
  2412.  
  2413.             If the duration of the signal is too short, the program may miss
  2414.  
  2415.             the signal as the modem toggles it.  One workaround that has been
  2416.  
  2417.             successfully is to check the RICHG bit returned from lc_mstat,
  2418.  
  2419.             rather than the RI bit.  The RICHG bit will be set when the RI
  2420.  
  2421.             bit comes one and again when the RI bit goes off. This is the
  2422.  
  2423.             method employed in the check_for_call function.
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.                                             17
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.        FUNCTION REFERENCE
  2472.  
  2473.  
  2474.  
  2475.             GENERAL INFORMATION
  2476.  
  2477.             In the following pages, we provide the detailed information about
  2478.  
  2479.             each available LiteComm ToolBox function.  Each function defini-
  2480.  
  2481.             tion includes, at a minimum, a summary of how to code the func-
  2482.  
  2483.             tion, a description of what the function does, and an indication
  2484.  
  2485.             of those values, if any, that the function might return.
  2486.  
  2487.  
  2488.  
  2489.             Where appropriate, we include additional documentation about the
  2490.  
  2491.             function.  Some definitions include examples, in the sense of
  2492.  
  2493.             code fragments illustrating the function's usage.  More impor-
  2494.  
  2495.             tantly, some definitions include additional notes and warnings as
  2496.  
  2497.             well as references to other functions within the package.
  2498.  
  2499.  
  2500.             We have made every effort to insure that the documentation of the
  2501.  
  2502.             functions is complete and accurate.  The style and manner of the
  2503.  
  2504.             documentation assume that the reader is thoroughly familiar with
  2505.  
  2506.             the elements of C syntax and common conventions.
  2507.  
  2508.  
  2509.  
  2510.             FLOW CONTROL
  2511.  
  2512.             In version 6 of LiteComm, we have incorporated fully automatic
  2513.  
  2514.             flow control, using either software, sometimes called XON-XOFF
  2515.  
  2516.             control, or hardware using the handshaking signals. 
  2517.  
  2518.             Note:
  2519.             Note:
  2520.             Note:It is not valid to have both methods of flow control active
  2521.  
  2522.             at the same time. Failure to observe this restriction can cause
  2523.  
  2524.             unpredictable results.
  2525.  
  2526.             GLOBAL ERROR VARIABLE
  2527.  
  2528.  
  2529.             Version 6 of LiteComm has a global error variable that is set by
  2530.  
  2531.             each of the LiteComm functions. The variable, _lc_error
  2532.                                                           _lc_error
  2533.                                                           _lc_error, is de-
  2534.  
  2535.             fined in LITECOMM.H. Possible values are in the file LITE-
  2536.  
  2537.             COMM.ERR. Examining the contents of _lc_error can help you
  2538.  
  2539.             diagnose and correct problems.
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.                                             18
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.        _portchg
  2568.  
  2569.  
  2570.  
  2571.             SUMMARY
  2572.  
  2573.             #include <litecomm.h>
  2574.  
  2575.  
  2576.             int _portchg(port, base, irq, vector)
  2577.  
  2578.             unsigned port;
  2579.  
  2580.             unsigned base;
  2581.  
  2582.             unsigned vector;
  2583.  
  2584.  
  2585.             char irq;
  2586.  
  2587.             DESCRIPTION
  2588.  
  2589.             Changes one or more of the critical parameters for COM3 or COM4.
  2590.  
  2591.             This function must be used before the opening port to be effec-
  2592.  
  2593.             tive. To leave any of the parameters at its default value, make
  2594.  
  2595.             the corresponding entry 0. Note that vector is a vector number,
  2596.  
  2597.             not an address or pointer.
  2598.  
  2599.             The irq parameter is NOT the irq (interrupt request) number, but
  2600.  
  2601.             the irq mask. The following lines, reproduced from 'litecomm.h'
  2602.  
  2603.             help illustrate this idea.
  2604.  
  2605.  
  2606.             #define IRQ1 0x10 /* int req mask for port 1 - irq4 */
  2607.  
  2608.             #define IRQ2 0x08 /* int req mask for port 2 - irq3 */
  2609.  
  2610.             Note:
  2611.             Note:
  2612.             Note:The value for irq4 is NOT 4, but a character in which bit 4,
  2613.  
  2614.             using INTEL's bit numbering, has a value of 1. Thus, to use irq
  2615.  
  2616.             priority 1 as the irq for either COM3 or COM4, you would specify
  2617.  
  2618.             0x02 as the value of irq when calling _portchg.
  2619.  
  2620.             The default parameters are in the litecomm.h include file.
  2621.  
  2622.  
  2623.             If you intend to change the default irq settings, you also MUST
  2624.                                                                        MUST
  2625.                                                                        MUST
  2626.  
  2627.             make a corresponding change to the vector number. See the accom-
  2628.  
  2629.             panying documentation about using COM3 and COM4 for additional
  2630.  
  2631.             details. Failure to follow this rule may make the port appear to
  2632.  
  2633.             be nonfunctional.
  2634.  
  2635.             The _portchg function does NOT check to determine that you have
  2636.  
  2637.             provided both an IRQ mask AND a new vector number.
  2638.  
  2639.  
  2640.             Example
  2641.             Example
  2642.             Example
  2643.  
  2644.  
  2645.  
  2646.                  if (_portchg(port, 0x408, 0, 0, 0) == -1)
  2647.  
  2648.                  {
  2649.  
  2650.                       printf("Error Changing Port %d\n", port);
  2651.  
  2652.                       exit(1);
  2653.  
  2654.                  }
  2655.  
  2656.  
  2657.  
  2658.             RETURN VALUES
  2659.  
  2660.             Returns 0 if the function is successful, -1 if you attempt to
  2661.  
  2662.             change a port other that 3 or 4.
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.                                             19
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.        comm_opn
  2677.  
  2678.  
  2679.  
  2680.             SUMMARY
  2681.  
  2682.             #include <litecomm.h>
  2683.  
  2684.  
  2685.             int comm_opn(port, baud, parity, datab, stopb, inbufsz, outbufsz,
  2686.  
  2687.             raisemdm)
  2688.  
  2689.             unsigned port;
  2690.  
  2691.             unsigned baud;
  2692.  
  2693.             unsigned parity;
  2694.  
  2695.  
  2696.             unsigned datab;
  2697.  
  2698.             unsigned stopb;
  2699.  
  2700.             unsigned inbufsz;
  2701.  
  2702.             unsigned outbufsz;
  2703.  
  2704.  
  2705.             DESCRIPTION
  2706.  
  2707.             Opens the specified port for use and attaches an interrupt han-
  2708.  
  2709.             dler to DOS for the port. Optionally, comm_opn will raise the DTR
  2710.  
  2711.             and RTS modem control signals, if the value of raisemdm is TRUE.
  2712.  
  2713.             The function allocates, from the heap, space for the CCB (com-
  2714.  
  2715.             munications control block), space for the interrupt handler's
  2716.  
  2717.             stack, and buffers for input and output of the specified sizes.
  2718.  
  2719.             The minimum value for inbufsz is 128; the minimum size for out-
  2720.  
  2721.             bufsz is 64.
  2722.  
  2723.             If sufficient memory is available and the parameters are correct,
  2724.  
  2725.             the port will be set to the parameters (baud rate, word length,
  2726.  
  2727.             stop bits) used when the function is called.  The memory overhead
  2728.  
  2729.             associated with opening a port can be approximated by adding
  2730.  
  2731.             about 1.2K bytes to the buffer sizes specified.
  2732.  
  2733.             comm_opn installs an exit handler using the atexit() function to
  2734.  
  2735.             protect DOS from problems that might arise if a program using
  2736.  
  2737.             LiteComm fails. Still, it is sound practice to close a port
  2738.  
  2739.             opened in this manner using comm_close explicitly in your program
  2740.  
  2741.             to gain maximum control over the port.
  2742.  
  2743.  
  2744.             The baud parameter is an unsigned integer that specifies the baud
  2745.  
  2746.             rate you intend to use, e.g., 4800. The other parameters passed
  2747.  
  2748.             to the function should be from the parameter set in the lite-
  2749.  
  2750.             comm.h include file.
  2751.  
  2752.  
  2753.  
  2754.             Example
  2755.             Example
  2756.             Example
  2757.  
  2758.  
  2759.             Below are two examples of using comm_opn, the first letting
  2760.  
  2761.             comm_opn raise the modem control signals, the second using two
  2762.  
  2763.             function calls to do the same thing.  The result of each example
  2764.  
  2765.             is the same, an open port on which the DTR and RTS signals have
  2766.  
  2767.             been raised.
  2768.  
  2769.             Example 1
  2770.             Example 1
  2771.             Example 1
  2772.  
  2773.             if (comm_opn(port, 1200, NPARITY, BIT8, STOP1, 256,
  2774.  
  2775.                     256, TRUE) == - 1)
  2776.  
  2777.             {
  2778.  
  2779.                  printf("Error Opening Port %d\n", port);
  2780.  
  2781.                  exit(1);
  2782.  
  2783.  
  2784.                                             20
  2785.  
  2786.  
  2787.  
  2788.  
  2789.  
  2790.             }
  2791.  
  2792.             Example 2
  2793.             Example 2
  2794.             Example 2
  2795.  
  2796.             if (comm_opn(port, 1200, NPARITY, BIT8, STOP1, 256,
  2797.  
  2798.                     256, FALSE) == - 1)
  2799.  
  2800.             {
  2801.  
  2802.  
  2803.                  printf("Error Opening Port %d\n", port);
  2804.  
  2805.                  exit(1);
  2806.  
  2807.             }
  2808.  
  2809.             lc_setmdm(port, (DTR | RTS));
  2810.  
  2811.  
  2812.  
  2813.             RETURN VALUES
  2814.  
  2815.             Upon successful open, the function returns port. If any error
  2816.  
  2817.             occurs, despite the type, the function returns -1.
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.  
  2847.  
  2848.  
  2849.  
  2850.  
  2851.  
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858.  
  2859.  
  2860.  
  2861.                                             21
  2862.  
  2863.  
  2864.  
  2865.  
  2866.  
  2867.        comm_close
  2868.  
  2869.  
  2870.  
  2871.             SUMMARY
  2872.  
  2873.             #include <litecomm.h>
  2874.  
  2875.  
  2876.             int comm_close(port, dropmdm)
  2877.  
  2878.             unsigned port;
  2879.  
  2880.             DESCRIPTION
  2881.  
  2882.             This function is the companion to comm_opn and, in effect, per-
  2883.  
  2884.             forms the opposite action. Comm_close detaches the library rou-
  2885.  
  2886.             tines from the interrupt handler, and reconnects the previous
  2887.  
  2888.             interrupt handler.
  2889.  
  2890.  
  2891.             Comm_close also releases all allocated memory used for the buff-
  2892.  
  2893.             ering and control structures described under comm_opn. If the
  2894.  
  2895.             value of dropmdm is non-zero, the port is closed absolutely, and
  2896.  
  2897.             all modem control signals are dropped.  If the value of dropmdm
  2898.  
  2899.             is zero, the port is closed conditionally, and both the DTR and
  2900.  
  2901.             RTS signals will be left in their current state. 
  2902.  
  2903.             Since comm_opn installs an exit handler using the atexit function
  2904.  
  2905.             in both Turbo C and Microsoft C, you are not required to close
  2906.  
  2907.             explicitly an open port.  However, if you do not explictly close
  2908.  
  2909.             the port, you will lose control over the handling of the DTR and
  2910.  
  2911.             RTS signals since the built-in exit handler uses the absolute
  2912.  
  2913.             form of the close.
  2914.  
  2915.  
  2916.             Example
  2917.             Example
  2918.             Example
  2919.  
  2920.  
  2921.             These are two equivalent examples of the comm_close function.
  2922.  
  2923.             The first uses the absolute port close, the second uses two
  2924.  
  2925.             function calls to do the same thing.
  2926.  
  2927.             Example 1
  2928.             Example 1
  2929.             Example 1
  2930.  
  2931.             comm_close(port, TRUE);       /* absolute close */
  2932.  
  2933.             Example 2
  2934.             Example 2
  2935.             Example 2
  2936.  
  2937.             lc_clrmdm(port, (RTS | DTR));  /* lower modem control */
  2938.  
  2939.             comm_close(port, FALSE); /* conditional close */
  2940.  
  2941.  
  2942.             RETURN VALUES
  2943.  
  2944.             If any error occurs, despite the type, the function returns -1.
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.                                             22
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.        comm_setup
  2970.  
  2971.  
  2972.  
  2973.             SUMMARY
  2974.  
  2975.             #include <litecomm.h>
  2976.  
  2977.  
  2978.             int comm_setup(port,baud,parity,datab,stopb)
  2979.  
  2980.             unsigned port;
  2981.  
  2982.             unsigned baud;
  2983.  
  2984.             unsigned parity;
  2985.  
  2986.  
  2987.             unsigned datab;
  2988.  
  2989.             unsigned stopb;
  2990.  
  2991.             DESCRIPTION
  2992.  
  2993.             The comm_setup function is a subset of the comm_opn function and
  2994.  
  2995.             the remarks made in the description of comm_opn regarding the
  2996.  
  2997.             port parameters apply.
  2998.  
  2999.  
  3000.             This function is useful if you wish to change the basic commu-
  3001.  
  3002.             nication parameters of the specified port that has already been
  3003.  
  3004.             opened without comm_close'ing the port.
  3005.  
  3006.  
  3007.  
  3008.             Example
  3009.             Example
  3010.             Example
  3011.  
  3012.  
  3013.             if (comm_setup(port, 1200, NPARITY, BIT8, STOP1) == 
  3014.  
  3015.                  -1)
  3016.  
  3017.             {
  3018.  
  3019.                  printf("Error Changing Port %d\n", port);
  3020.  
  3021.                  exit(1);
  3022.  
  3023.             }
  3024.  
  3025.  
  3026.  
  3027.             RETURN VALUES
  3028.  
  3029.             If any error occurs, despite the type, the function returns -1.
  3030.  
  3031.             SEE ALSO
  3032.  
  3033.  
  3034.             comm_opn
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.  
  3044.  
  3045.  
  3046.  
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.                                             23
  3056.  
  3057.  
  3058.  
  3059.  
  3060.  
  3061.        lc_vport
  3062.  
  3063.  
  3064.  
  3065.             SUMMARY
  3066.  
  3067.             #include <litecomm.h>
  3068.  
  3069.  
  3070.             COMM *lc_vport(port)
  3071.  
  3072.             DESCRIPTION
  3073.  
  3074.             lc_vport is a macro that validates that the port number specified
  3075.  
  3076.             is correct and has been opened with the comm_opn function. It may
  3077.  
  3078.             be of use to you in writing certain applications.
  3079.  
  3080.  
  3081.             RETURN VALUES
  3082.  
  3083.             If the port is valid and has been opened, returns a pointer to
  3084.  
  3085.             the CCB (communications control block) for the port. Returns NULL
  3086.  
  3087.             if an error occurs;
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.  
  3114.  
  3115.  
  3116.  
  3117.  
  3118.  
  3119.  
  3120.  
  3121.  
  3122.  
  3123.  
  3124.  
  3125.  
  3126.  
  3127.  
  3128.  
  3129.  
  3130.                                             24
  3131.  
  3132.  
  3133.  
  3134.  
  3135.  
  3136.        lc_icnt, lc_ocnt
  3137.  
  3138.  
  3139.  
  3140.             SUMMARY
  3141.  
  3142.             #include <litecomm.h>
  3143.  
  3144.  
  3145.             int lc_icnt(port)
  3146.  
  3147.             int lc_ocnt(port)
  3148.  
  3149.             unsigned port;
  3150.  
  3151.             DESCRIPTION
  3152.  
  3153.  
  3154.             These functions may be used to determine the number of characters
  3155.  
  3156.             currently in the input(lc_icnt) or output(lc_ocnt) buffers for
  3157.  
  3158.             the port.
  3159.  
  3160.  
  3161.  
  3162.             Example
  3163.             Example
  3164.             Example
  3165.  
  3166.  
  3167.             #include <litecomm.h>
  3168.  
  3169.             if (lc_icnt(port))       /* anything received ? */
  3170.  
  3171.                 puts("Characters waiting in input");
  3172.  
  3173.  
  3174.  
  3175.             RETURN VALUES
  3176.  
  3177.             Both functions return -1 if an error occurs (port not open or
  3178.  
  3179.             invalid port number). The lc_icnt() function returns the number
  3180.  
  3181.             of characters in the input buffer; lc_ocnt() returns the number
  3182.  
  3183.             of characters remaining in the transmit buffer.
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.                                             25
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.        lc_mstat
  3221.  
  3222.  
  3223.  
  3224.             SUMMARY
  3225.  
  3226.             #include <litecomm.h>
  3227.  
  3228.  
  3229.             int lc_mstat(port)
  3230.  
  3231.             unsigned port;
  3232.  
  3233.             DESCRIPTION
  3234.  
  3235.             May be used to determine the last known state of the modem-
  3236.  
  3237.             supplied handshake signals. These may be tested using the values
  3238.  
  3239.             in the include file litecomm.h. 
  3240.  
  3241.  
  3242.             The handshake signals consist of a byte in which the bits 4-7
  3243.  
  3244.             contain the current state of the signals (such as Clear To Send
  3245.  
  3246.             or CTS). Bits 0-3 contain information regarding whether
  3247.  
  3248.             individual signals have changed. lc_mstat always returns the
  3249.  
  3250.             current values of the signals in bits 4-7.  Bits 0-3 will reflect
  3251.  
  3252.             which, if any, of the signals has changed.  
  3253.  
  3254.             The easiest approach to dealing with the returned value is to
  3255.  
  3256.             test bits 0-3 (the DELTA or change bits) for a non-zero value.
  3257.  
  3258.             If any non-zero value is found in bits 0-3, one or more signals
  3259.  
  3260.             have changed _____ ___ ____ ____ __ ________
  3261.                          since the last call to lc_mstat.  
  3262.  
  3263.             Note:
  3264.             Note:
  3265.             Note:The functions resets the DELTA bits.  The value obtained
  3266.  
  3267.             from bits 4- 7 will correctly reflect the current state of the
  3268.  
  3269.             signals.
  3270.  
  3271.             To examine individual signals, litecomm.h has #defined symbols
  3272.  
  3273.             for the change bits ,e.g., CTSCHG, and for the signals themselves
  3274.  
  3275.             ,e.g.. CTS. 
  3276.  
  3277.  
  3278.  
  3279.  
  3280.             Example
  3281.             Example
  3282.             Example
  3283.  
  3284.             int curstat;
  3285.  
  3286.  
  3287.             curstat = lc_mstat(port);
  3288.             /* get curent values */
  3289.  
  3290.  
  3291.             if (curstat & DCDCHG)         /* DCD changed ? */
  3292.  
  3293.                 if (! (curstat & DCD))
  3294.  
  3295.             /* carrier still on */
  3296.  
  3297.                    puts("Remote is off-line, carrier lost");
  3298.  
  3299.  
  3300.  
  3301.             RETURN VALUES
  3302.  
  3303.             If the port is valid and open, returns the current modem status
  3304.  
  3305.             bits. Returns -1 if an error occurs.
  3306.  
  3307.             SEE ALSO
  3308.  
  3309.             lc_got???
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.  
  3316.  
  3317.  
  3318.  
  3319.  
  3320.                                             26
  3321.  
  3322.  
  3323.  
  3324.  
  3325.  
  3326.        lc_got???
  3327.  
  3328.  
  3329.  
  3330.             SUMMARY
  3331.  
  3332.             #include "litecomm.h"
  3333.  
  3334.  
  3335.             unsigned port;
  3336.  
  3337.             lc_gotcts(port);
  3338.  
  3339.             lc_gotdsr(port);
  3340.  
  3341.             lc_gotri(port);
  3342.  
  3343.  
  3344.             lc_gotdcd(port);
  3345.  
  3346.             lc_gotctschg(port);
  3347.  
  3348.             lc_gotdsrchg(port);
  3349.  
  3350.             lc_gotrichg(port);
  3351.  
  3352.  
  3353.             lc_gotdcdchg(port);
  3354.  
  3355.  
  3356.             DESCRIPTION
  3357.  
  3358.             This set of 8 macros makes the job of testing the individual mo-
  3359.  
  3360.             dem status signals simpler.
  3361.  
  3362.  
  3363.             The macros rely upon the lc_mstat function and you should refer
  3364.  
  3365.             to the description of that function for additional information.
  3366.  
  3367.             SEE ALSO
  3368.  
  3369.             lc_mstat
  3370.  
  3371.  
  3372.  
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382.  
  3383.  
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.  
  3392.  
  3393.  
  3394.  
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.                                             27
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.        lc_estat
  3409.  
  3410.  
  3411.  
  3412.             SUMMARY
  3413.  
  3414.             #include <litecomm.h>
  3415.  
  3416.  
  3417.             int lc_estat(port)
  3418.  
  3419.             unsigned port;
  3420.  
  3421.             DESCRIPTION
  3422.  
  3423.             May be used to determine the last known state of the serial
  3424.  
  3425.             port's error status bits. These may be tested using the values in
  3426.  
  3427.             the include file litecomm.h.
  3428.  
  3429.  
  3430.             The errors that are detected and reported include:
  3431.  
  3432.             ORUNERR - failure to fetch a character from the port before the
  3433.  
  3434.             next character arrived.  Usually a problem in the interrupt han-
  3435.  
  3436.             dler.
  3437.  
  3438.             PARERR - One or more characters were received in which the parity
  3439.  
  3440.             of the character(s) did not match the current parity setting of
  3441.  
  3442.             the port.  Can be caused by line noise, or by other causes.
  3443.  
  3444.             FRMERR - A framing error has occurred.  A character arrived that
  3445.  
  3446.             had too few or (more likely) too many bits.  Usually caused by
  3447.  
  3448.             line noise.
  3449.  
  3450.  
  3451.             RETURN VALUES
  3452.  
  3453.             If the port is valid and open, returns the current error status
  3454.  
  3455.             bits. Returns -1 if an error occurs.
  3456.  
  3457.  
  3458.  
  3459.  
  3460.  
  3461.  
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.                                             28
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.        lc_getw
  3494.  
  3495.  
  3496.  
  3497.             SUMMARY
  3498.  
  3499.             #include <litecomm.h>
  3500.  
  3501.  
  3502.             int lc_getw(port)
  3503.  
  3504.             unsigned port;
  3505.  
  3506.             DESCRIPTION
  3507.  
  3508.             Reads a character from the serial port's input buffer. Waits in-
  3509.  
  3510.             definitely until a character is available.  If the port is dis-
  3511.  
  3512.             connected for any reason, this function will cause a system hang
  3513.  
  3514.             if called, so its use should be carefully controlled.
  3515.  
  3516.  
  3517.             RETURN VALUES
  3518.  
  3519.             Returns the next available character in the input buffer for the
  3520.  
  3521.             port. Returns -1 if the port is not active, or if an invalid port
  3522.  
  3523.             number is specified.
  3524.  
  3525.  
  3526.  
  3527.  
  3528.  
  3529.  
  3530.  
  3531.  
  3532.  
  3533.  
  3534.  
  3535.  
  3536.  
  3537.  
  3538.  
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.  
  3561.  
  3562.  
  3563.  
  3564.                                             29
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.        lc_setmdm
  3571.  
  3572.  
  3573.  
  3574.             SUMMARY
  3575.  
  3576.             #include <litecomm.h>
  3577.  
  3578.  
  3579.             int lc_setmdm(port, newset)
  3580.  
  3581.             unsigned port;
  3582.  
  3583.             unsigned newset;
  3584.  
  3585.             DESCRIPTION
  3586.  
  3587.  
  3588.             Set one or more of the modem control signals. Because of the need
  3589.  
  3590.             to have OUT2 set for interrupt support, the function always pro-
  3591.  
  3592.             vides the correct setting for this bit. Use the symbolic #defines
  3593.  
  3594.             found in the litecomm.h file.  Many applications will not require
  3595.  
  3596.             this function, if they allow comm_opn to raise these two signals.
  3597.  
  3598.             More sophisticated applications may be required to control either
  3599.  
  3600.             or both of the signals to provide handshaking with an external
  3601.  
  3602.             device.
  3603.  
  3604.  
  3605.  
  3606.             Example
  3607.             Example
  3608.             Example
  3609.  
  3610.  
  3611.             /* raise the RTS modem control signal */
  3612.  
  3613.                  lc_setmdm(port, RTS);
  3614.  
  3615.             /* raise both RTS and DTR */
  3616.  
  3617.                  lc_setmdm(port, (RTS | DTR));
  3618.  
  3619.  
  3620.  
  3621.             RETURN VALUES
  3622.  
  3623.             Returns 0 if the operation was successful, returns -1 otherwise.
  3624.  
  3625.             SEE ALSO
  3626.  
  3627.             comm_opn, lc_clrmdm, lc_togmdm, lc_setdtr, lc_setrts 
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642.  
  3643.  
  3644.  
  3645.  
  3646.  
  3647.  
  3648.  
  3649.  
  3650.  
  3651.  
  3652.  
  3653.                                             30
  3654.  
  3655.  
  3656.  
  3657.  
  3658.  
  3659.        lc_setdtr, lc_setrts
  3660.  
  3661.  
  3662.  
  3663.  
  3664.             SUMMARY
  3665.  
  3666.  
  3667.             #include "litecomm.h"
  3668.  
  3669.             unsigned port;
  3670.  
  3671.             lc_setdtr(port);
  3672.  
  3673.             lc_setrts(port);
  3674.  
  3675.  
  3676.             DESCRIPTION
  3677.  
  3678.             lc_setdtr and lc_setrts are macros designed to help make your
  3679.  
  3680.             code more explicit. Both macros use the lc_setmdm function to set
  3681.  
  3682.             the DTR and RTS signals. Note that no effort is made to preserve
  3683.  
  3684.             the current modem signal status. That is use of the lc_setdtr
  3685.  
  3686.             macro will cause RTS to drop. The  converse is true of lc_setrts.
  3687.  
  3688.             SEE ALSO
  3689.  
  3690.             lc_setmdm
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.  
  3729.  
  3730.                                             31
  3731.  
  3732.  
  3733.  
  3734.  
  3735.  
  3736.        lc_clrmdm
  3737.  
  3738.  
  3739.  
  3740.             SUMMARY
  3741.  
  3742.             #include <litecomm.h>
  3743.  
  3744.  
  3745.             int lc_clrmdm(port, newset)
  3746.  
  3747.             unsigned port;
  3748.  
  3749.             unsigned newset;
  3750.  
  3751.             DESCRIPTION
  3752.  
  3753.  
  3754.             Companion to the setmdm function. Clears the modem control sig-
  3755.  
  3756.             nals RTS or DTR or both. Because of the need to have OUT2 set for
  3757.  
  3758.             interrupt support, the function always provides the correct set-
  3759.  
  3760.             ting for this bit. Use the symbolic #defines found in the lite-
  3761.  
  3762.             comm.h file. Generally, this function only has value if you
  3763.  
  3764.             trying to implement some form of hardware handshaking with
  3765.  
  3766.             another device.  The comm_close function will lower both RTS and
  3767.  
  3768.             DTS automatically, if told to do so.
  3769.  
  3770.  
  3771.             Example
  3772.             Example
  3773.             Example
  3774.  
  3775.             /* lower the RTS modem control signal */
  3776.  
  3777.                  lc_clrmdm(port, RTS);
  3778.  
  3779.  
  3780.             /* lower both RTS and DTR */
  3781.  
  3782.                  lc_clrmdm(port, (RTS | DTR));
  3783.  
  3784.  
  3785.             RETURN VALUES
  3786.  
  3787.  
  3788.             Returns 0 if the operation was successful, returns -1 otherwise.
  3789.  
  3790.             SEE ALSO
  3791.  
  3792.             comm_close, lc_setmdm, lc_togmdm 
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.                                             32
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.        lc_togmdm
  3826.  
  3827.  
  3828.  
  3829.             SUMMARY
  3830.  
  3831.             #include <litecomm.h>
  3832.  
  3833.  
  3834.             int lc_togmdm(port, newset)
  3835.  
  3836.             unsigned port;
  3837.  
  3838.             unsigned newset;
  3839.  
  3840.             DESCRIPTION
  3841.  
  3842.  
  3843.             Companion to setmdm function. Inverts (flip-flops) the modem
  3844.  
  3845.             control signals RTS or DTR or both. Because of the need to have
  3846.  
  3847.             OUT2 set for interrupt support, the function always provides the
  3848.  
  3849.             correct setting for this bit. Use the symbolic #defines found in
  3850.  
  3851.             the litecomm.h file.  This function may have value if you are
  3852.  
  3853.             trying to implement hardware handshaking.
  3854.  
  3855.  
  3856.             Example
  3857.             Example
  3858.             Example
  3859.  
  3860.             /* 
  3861.  
  3862.             ** change the RTS modem control signal to its other
  3863.  
  3864.  
  3865.             ** state (e.g. if raised, lower, and if lowered, raise
  3866.  
  3867.             */
  3868.  
  3869.                  lc_togmdm(port, RTS);
  3870.  
  3871.  
  3872.  
  3873.             RETURN VALUES
  3874.  
  3875.             Returns 0 if the operation was successful, returns -1 otherwise.
  3876.  
  3877.             SEE ALSO
  3878.  
  3879.             lc_setmdm, lc_clrmdm 
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.  
  3906.  
  3907.                                             33
  3908.  
  3909.  
  3910.  
  3911.  
  3912.  
  3913.        lc_xoff 
  3914.  
  3915.  
  3916.  
  3917.             SUMMARY
  3918.  
  3919.             #include <litecomm.h>
  3920.  
  3921.  
  3922.             int lc_xoff(port, flag)
  3923.  
  3924.             unsigned port;
  3925.  
  3926.             int flag; 
  3927.  
  3928.             DESCRIPTION
  3929.  
  3930.  
  3931.             If flag is non-zero, the function enables automatic software flow
  3932.  
  3933.             control function. If flag is zero (the default setting),
  3934.  
  3935.             automatic flow control is disabled.
  3936.  
  3937.  
  3938.             When enabled, the LiteComm kernel will automatically transmit the
  3939.  
  3940.             OFF character when the input buffer is approximately 2/3 full and
  3941.  
  3942.             will automatically recognize an OFF character sent by the other
  3943.  
  3944.             device. If the other device transmits an OFF character, the ker-
  3945.  
  3946.             nel will refuse to send any characters until the condition is
  3947.  
  3948.             cleared by receipt of the ON character or by disabling software
  3949.  
  3950.             flow control altogether.  
  3951.  
  3952.             The recognition functionality is implimented in the kernel.  As a
  3953.  
  3954.             result, the transmit buffer will continue to accept input from
  3955.  
  3956.             your program until the buffer fills completely, even though the
  3957.  
  3958.             information will not be sent.  Once the matching ON character is
  3959.  
  3960.             received, the contents of the transmit buffer will be sent
  3961.  
  3962.             rapidly to the other device.  It is possible that the rate with
  3963.  
  3964.             which characters are sent when this occurs may cause problems for
  3965.  
  3966.             the other device, depending on its ability to handle the data
  3967.  
  3968.             flow.
  3969.  
  3970.  
  3971.             If you intended to implement a protocol that might include the ON
  3972.  
  3973.             or OFF characters, be sure to disable the automatic flow control.
  3974.  
  3975.             Failure to do so may result in a system hang.
  3976.  
  3977.  
  3978.             By default, software flow control uses the XON-XOFF flow control
  3979.  
  3980.             characters. You may change the characters to suit your applica-
  3981.  
  3982.             tion by using the lc_setxon and lc_setxoff functions.
  3983.  
  3984.             RETURN VALUES
  3985.  
  3986.  
  3987.             Returns 0 if the operation was successful, returns -1 otherwise.
  3988.  
  3989.             SEE ALSO
  3990.  
  3991.             lc_gotxoff, lc_putxoff, lc_setxon, lc_setxoff
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.                                             34
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.        lc_gotxoff
  4013.  
  4014.  
  4015.  
  4016.             SUMMARY
  4017.  
  4018.             #include <litecomm.h>
  4019.  
  4020.  
  4021.             int lc_gotxoff(port)
  4022.  
  4023.             unsigned port;
  4024.  
  4025.             DESCRIPTION
  4026.  
  4027.             If the OFF character has been received, this function will return
  4028.  
  4029.             a non-zero value. A zero is returned if the OFF character is
  4030.  
  4031.             never received, or if the ON character is detected.
  4032.  
  4033.  
  4034.             Note:
  4035.             Note:
  4036.             Note:Unlike older versions of LiteComm, lc_gotxoff is now useful
  4037.  
  4038.             only for information. It does not alter the way in which software
  4039.  
  4040.             flow control operates.
  4041.  
  4042.             RETURN VALUES
  4043.  
  4044.             Returns a nonzero value if the OFF character was detected, zero
  4045.  
  4046.             if an OFF character was not detected, or if the ON character is
  4047.  
  4048.             detected. Will return -1 in the case of an error.
  4049.  
  4050.  
  4051.             SEE ALSO
  4052.  
  4053.             lc_xoff, lc_putxoff, lc_setxon, lc_setxoff
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.                                             35
  4090.  
  4091.  
  4092.  
  4093.  
  4094.  
  4095.        lc_putxoff
  4096.  
  4097.  
  4098.  
  4099.             SUMMARY
  4100.  
  4101.             #include <litecomm.h>
  4102.  
  4103.  
  4104.             int lc_putxoff(port)
  4105.  
  4106.             unsigned port;
  4107.  
  4108.             DESCRIPTION
  4109.  
  4110.             See below for the values returned. If the LiteComm kernel has
  4111.  
  4112.             sent the OFF character.
  4113.  
  4114.  
  4115.             Note:
  4116.             Note:
  4117.             Note:Unlike older versions of LiteComm, this function provides
  4118.  
  4119.             information only. Use of the function has no effect upon software
  4120.  
  4121.             flow control. 
  4122.  
  4123.             RETURN VALUES
  4124.  
  4125.             Returns a nonzero value if an OFF character was sent to the other
  4126.  
  4127.             device, zero if an OFF was not sent, or if the ON character has
  4128.  
  4129.             been sent. Will return -1 in the case of an error.
  4130.  
  4131.  
  4132.             SEE ALSO
  4133.  
  4134.             lc_xoff, lc_putxoff, lc_setxon, lc_setxoff
  4135.  
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.  
  4142.  
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.  
  4168.  
  4169.  
  4170.  
  4171.                                             36
  4172.  
  4173.  
  4174.  
  4175.  
  4176.  
  4177.        lc_setxon, lc_setxoff
  4178.  
  4179.  
  4180.  
  4181.             SUMMARY
  4182.  
  4183.             #include "litecomm.h"
  4184.  
  4185.  
  4186.             int lc_setxon(port, xonchar);
  4187.  
  4188.             int lc_setxoff(port, xoffchar);
  4189.  
  4190.             unsigned port;
  4191.  
  4192.             unsigned char xonchar;
  4193.  
  4194.  
  4195.             unsigned char xoff char;
  4196.  
  4197.             DESCRIPTION
  4198.  
  4199.             These functions are part of the software flow control functonal-
  4200.  
  4201.             ity of LiteComm. By default, LiteComm's software flow control
  4202.  
  4203.             uses the XON-XOFF character scheme. If your application has dif-
  4204.  
  4205.             ferent requirements, use the lc_setxon function to change the ON
  4206.  
  4207.             character, lc_setxoff to set the OFF character.
  4208.  
  4209.             RETURN VALUES
  4210.  
  4211.  
  4212.             Both functions return a -1 if an error occurs. Both return a
  4213.  
  4214.             value of zero (0) if there is no error.
  4215.  
  4216.             SEE ALSO
  4217.  
  4218.             lc_xoff, lc_gotxoff, lc_putxoff
  4219.  
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.                                             37
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.        lc_sethwflow
  4260.  
  4261.  
  4262.  
  4263.             SUMMARY
  4264.  
  4265.             #include "litecomm.h"
  4266.  
  4267.  
  4268.             int lc_sethwflow(port, flowtype)
  4269.  
  4270.             unsigned port;
  4271.  
  4272.             unsigned char flowtype;
  4273.  
  4274.             DESCRIPTION
  4275.  
  4276.  
  4277.             This function specifies the type of hardware flow control to use
  4278.  
  4279.             and activates hardware flow control. The point at which hardware
  4280.  
  4281.             flow control is activated is the same as for software flow con-
  4282.  
  4283.             trol.
  4284.  
  4285.  
  4286.             You have complete control over which hardware signals are used
  4287.  
  4288.             for flow control. For output (from the port) control specify ei-
  4289.  
  4290.             ther USEDSR or USECTS. For input (to the port) control, specify
  4291.  
  4292.             either USEDTR or USERTS. Since most hardware flow control schemes
  4293.  
  4294.             employ both input and output flow control, you should OR the re-
  4295.  
  4296.             quired values together, as shown in the example. Hardware flow
  4297.  
  4298.             control remains in effect until you issue the lc_clearhwflow
  4299.  
  4300.             function.
  4301.  
  4302.  
  4303.  
  4304.             Note:
  4305.             Note:
  4306.             Note:The flow control scheme assumes that the input flow control
  4307.  
  4308.             signal (RTS or DTR) have been set to the correct starting value
  4309.  
  4310.             by the program. Thereafter, LiteComm flow control will manage the
  4311.  
  4312.             signals.
  4313.  
  4314.  
  4315.  
  4316.             Example
  4317.             Example
  4318.             Example
  4319.  
  4320.  
  4321.             /* Use RTS-CTS flow control */
  4322.  
  4323.             if  lc_sethwflow(port, (USECTS | USERTS))
  4324.  
  4325.                  puts("Error setting flow control");
  4326.  
  4327.  
  4328.  
  4329.             RETURN VALUES
  4330.  
  4331.             The function returns a value of zero (0) if successful. If an
  4332.  
  4333.             error occurs, the function returns -1.
  4334.  
  4335.             SEE ALSO
  4336.  
  4337.             lc_xoff, lc_clearhwflow, lc_puthwstop, lc_gothwstop
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.                                             38
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.        lc_clearhwflow
  4359.  
  4360.  
  4361.  
  4362.             SUMMARY
  4363.  
  4364.             #include "litecomm.h"
  4365.  
  4366.  
  4367.             int lc_clearhwflow(port)
  4368.  
  4369.             unsigned port;
  4370.  
  4371.             DESCRIPTION
  4372.  
  4373.             Immediately deactivates hardware flow control. Any untransmitted
  4374.  
  4375.             characters will be sent as rapidly as possible.
  4376.  
  4377.  
  4378.             RETURN VALUES
  4379.  
  4380.             If successful, returns a value of zero (0). Retuirns -1 if an
  4381.  
  4382.             error occurs.
  4383.  
  4384.             SEE ALSO
  4385.  
  4386.  
  4387.             lc_sethwflow, lc_puthwstop, lc_gothwstop
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.  
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.                                             39
  4429.  
  4430.  
  4431.  
  4432.  
  4433.  
  4434.        lc_puthwstop
  4435.  
  4436.  
  4437.  
  4438.             SUMMARY
  4439.  
  4440.             #include "litecomm.h"
  4441.  
  4442.  
  4443.             int lc_puthwstop(port)
  4444.  
  4445.             unsigned port;
  4446.  
  4447.             DESCRIPTION
  4448.  
  4449.             Indicates whether or not LiteComm has instructed the remote de-
  4450.  
  4451.             vice to stop transmitting.
  4452.  
  4453.  
  4454.             RETURN VALUES
  4455.  
  4456.             If an error occurs, returns a value of -1. If input flow control
  4457.  
  4458.             has not been asserted, returns a value of zero (0). If input flow
  4459.  
  4460.             control has been asserted, returns a positive, non-zero value;
  4461.  
  4462.             SEE ALSO
  4463.  
  4464.  
  4465.             lc_sethwflow, lc_gothwflow
  4466.  
  4467.  
  4468.  
  4469.  
  4470.  
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502.  
  4503.  
  4504.  
  4505.                                             40
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.        lc_gothwstop
  4512.  
  4513.  
  4514.  
  4515.             SUMMARY
  4516.  
  4517.             #include "litecomm.h"
  4518.  
  4519.  
  4520.             int lc_gothwstop(port)
  4521.  
  4522.             unsigned port;
  4523.  
  4524.             DESCRIPTION
  4525.  
  4526.             Indicates whether or not LiteComm has been instructed by the re-
  4527.  
  4528.             mote device to stop transmitting.
  4529.  
  4530.  
  4531.             RETURN VALUES
  4532.  
  4533.             If an error occurs, returns a value of -1. If output flow control
  4534.  
  4535.             has not been asserted, returns a value of zero (0). If output
  4536.  
  4537.             flow control has been asserted by the remote device, returns a
  4538.  
  4539.             positive, non-zero value;
  4540.  
  4541.             SEE ALSO
  4542.  
  4543.  
  4544.             lc_sethwflow, lc_puthwflow
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.  
  4568.  
  4569.  
  4570.  
  4571.  
  4572.  
  4573.  
  4574.  
  4575.  
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.                                             41
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.        lc_get
  4590.  
  4591.  
  4592.  
  4593.             SUMMARY
  4594.  
  4595.             #include <litecomm.h>
  4596.  
  4597.  
  4598.             int lc_get(port)
  4599.  
  4600.             unsigned port;
  4601.  
  4602.             DESCRIPTION
  4603.  
  4604.             Read a character from the serial port's input buffer. Discard
  4605.  
  4606.             (ignore) the matching status value
  4607.  
  4608.  
  4609.  
  4610.  
  4611.             Example
  4612.             Example
  4613.             Example
  4614.  
  4615.             if ((ch = lc_get(port)) != -1)
  4616.  
  4617.             /* any chars? */
  4618.  
  4619.                  ch &= 0x7f;         /* mask parity */
  4620.  
  4621.  
  4622.  
  4623.             RETURN VALUES
  4624.  
  4625.             Returns the next available character in the input buffer for the
  4626.  
  4627.             port. If you specified other than NO PARITY when you opened the
  4628.  
  4629.             port, you may have to mask (make zero) the parity bit before you
  4630.  
  4631.             use the character. Returns -1 if the port is not active, or if
  4632.  
  4633.             there are not characters in the port's buffer.
  4634.  
  4635.  
  4636.             SEE ALSO
  4637.  
  4638.             lc_getstat, wait, purge
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.                                             42
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.        lc_getstat
  4675.  
  4676.  
  4677.  
  4678.             SUMMARY
  4679.  
  4680.             #include "litecomm.h"
  4681.  
  4682.  
  4683.             int lc_getstat(port, ch, status);
  4684.  
  4685.             unsigned port;
  4686.  
  4687.             unsigned char *ch;
  4688.  
  4689.             unsigned char *status;
  4690.  
  4691.  
  4692.             DESCRIPTION
  4693.  
  4694.             This function retrieves the next character and its corresponding
  4695.  
  4696.             error status from the LiteComm buffers, if there are characters
  4697.  
  4698.             available. The status that is returned is the value of the error
  4699.  
  4700.             status register at the time the character was received. For more
  4701.  
  4702.             information about the error status see the lc_estat function.
  4703.  
  4704.             Note:
  4705.             Note:
  4706.             Note:The variables for ch and status must both be pointers.
  4707.  
  4708.  
  4709.             RETURN VALUES
  4710.  
  4711.             If there are characters available and no other errors occur, the
  4712.  
  4713.             function will return a value of zero (0). If there are no other
  4714.  
  4715.             characters, or if some other error occurs, the function returns a
  4716.  
  4717.             value of -1.
  4718.  
  4719.             SEE ALSO
  4720.  
  4721.             lc_get, lc_estat, wait, purge
  4722.  
  4723.  
  4724.  
  4725.  
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.  
  4736.  
  4737.  
  4738.  
  4739.  
  4740.  
  4741.  
  4742.  
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.                                             43
  4755.  
  4756.  
  4757.  
  4758.  
  4759.  
  4760.        wait
  4761.  
  4762.  
  4763.  
  4764.             SUMMARY
  4765.  
  4766.             #include "litecomm.h"
  4767.  
  4768.  
  4769.             int wait(port, secs, sig_to_check);
  4770.  
  4771.             unsigned port;
  4772.  
  4773.             int secs;
  4774.  
  4775.             unsigned char sig_to_check;
  4776.  
  4777.  
  4778.             DESCRIPTION
  4779.  
  4780.             The wait function waits for secs seconds for input from the des-
  4781.  
  4782.             ignated port before returning. Optionally, wait will also monitor
  4783.  
  4784.             one or more of the modem status signals and return if the signal
  4785.  
  4786.             drops.
  4787.  
  4788.  
  4789.             Secs must be greater than zero. If you do not want wait to moni-
  4790.  
  4791.             tor a modem status signal, specify zero (0) as sig_to_check. To
  4792.  
  4793.             specify a signal, use the constants, such as DCD, found in lite-
  4794.  
  4795.             comm.h.
  4796.  
  4797.  
  4798.  
  4799.             Note:
  4800.             Note:
  4801.             Note:Valid signal values are CTS, DCD, DSR, and RI.
  4802.  
  4803.             RETURN VALUES
  4804.  
  4805.             If a character is retrieved within the time allowed, the function
  4806.  
  4807.             returns the character. If a character is not available in the
  4808.  
  4809.             specified time, if the specified signal is lost, or if some other
  4810.  
  4811.             error occurs, the function returns a value of -1.
  4812.  
  4813.  
  4814.             SEE ALSO
  4815.  
  4816.             lc_get, lc_getstat
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838.  
  4839.  
  4840.  
  4841.  
  4842.  
  4843.                                             44
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.        purge
  4850.  
  4851.  
  4852.  
  4853.             SUMMARY
  4854.  
  4855.             #include "litecomm.h";
  4856.  
  4857.  
  4858.             void purge(port);
  4859.  
  4860.             unsigned port;
  4861.  
  4862.             DESCRIPTION
  4863.  
  4864.             The purge function discards any characters received until there
  4865.  
  4866.             are no more incoming characters for a period of 1 second.
  4867.  
  4868.  
  4869.             RETURN VALUES
  4870.  
  4871.             This function does not return any value;
  4872.  
  4873.             SEE ALSO
  4874.  
  4875.  
  4876.             wait
  4877.  
  4878.  
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.  
  4895.  
  4896.  
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.                                             45
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.        lc_peek
  4925.  
  4926.  
  4927.  
  4928.             SUMMARY
  4929.  
  4930.             #include <litecomm.h>
  4931.  
  4932.  
  4933.             int lc_peek(port)
  4934.  
  4935.             unsigned port;
  4936.  
  4937.             DESCRIPTION
  4938.  
  4939.             Look at the next character in the serial port's input buffer. Do
  4940.  
  4941.             not remove the character from the buffer.
  4942.  
  4943.  
  4944.             RETURN VALUES
  4945.  
  4946.             Returns the next available character in the input buffer for the
  4947.  
  4948.             port, but does not remove the character from the buffer. This
  4949.  
  4950.             allows the application to look-ahead by one character in a
  4951.  
  4952.             nondestructive fashion. See additional comments under lc_get re-
  4953.  
  4954.             garding parity. Returns -1 if the port is not active, or if there
  4955.  
  4956.             are no characters in the port's buffer.
  4957.  
  4958.  
  4959.  
  4960.  
  4961.  
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.  
  4968.  
  4969.  
  4970.  
  4971.  
  4972.  
  4973.  
  4974.  
  4975.  
  4976.  
  4977.  
  4978.  
  4979.  
  4980.  
  4981.  
  4982.  
  4983.  
  4984.  
  4985.  
  4986.  
  4987.  
  4988.  
  4989.  
  4990.  
  4991.  
  4992.  
  4993.  
  4994.  
  4995.  
  4996.                                             46
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.        lc_put
  5003.  
  5004.  
  5005.  
  5006.             SUMMARY
  5007.  
  5008.             #include <litecomm.h>
  5009.  
  5010.  
  5011.             int lc_put(port,ch)
  5012.  
  5013.             unsigned port;
  5014.  
  5015.             char ch;
  5016.  
  5017.             DESCRIPTION
  5018.  
  5019.  
  5020.             Place a character into the serial port's output buffer.
  5021.  
  5022.             RETURN VALUES
  5023.  
  5024.             Returns 0 if successful. Note that this does not guarantee that
  5025.  
  5026.             the character has been sent, only that no errors were detected,
  5027.  
  5028.             and that there was room in the transmit buffer for the character.
  5029.  
  5030.             Characters are sent from the transmit buffer when the system has
  5031.  
  5032.             time to send them, assuming all conditions for transmission are
  5033.  
  5034.             satisified.  Returns -1 if the port is not active, or if there no
  5035.  
  5036.             room in the port's buffer.
  5037.  
  5038.  
  5039.  
  5040.  
  5041.  
  5042.  
  5043.  
  5044.  
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062.  
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.  
  5072.  
  5073.  
  5074.  
  5075.                                             47
  5076.  
  5077.  
  5078.  
  5079.  
  5080.  
  5081.        lc_gets
  5082.  
  5083.  
  5084.  
  5085.             SUMMARY
  5086.  
  5087.             #include <litecomm.h>
  5088.  
  5089.  
  5090.             int lc_gets(port, buff, cnt)
  5091.  
  5092.             unsigned port;
  5093.  
  5094.             char *buff;
  5095.  
  5096.             int cnt;
  5097.  
  5098.  
  5099.             DESCRIPTION
  5100.  
  5101.             Read a stream of, at most, cnt characters from the serial port's
  5102.  
  5103.             input buffer into the buff location. Ignore and discard any sta-
  5104.  
  5105.             tus information. This function is not sensitive to the NULL
  5106.  
  5107.             character. See lc_get for additional information.
  5108.  
  5109.  
  5110.  
  5111.  
  5112.             Example
  5113.             Example
  5114.             Example
  5115.  
  5116.             char * j;
  5117.  
  5118.             int k;
  5119.  
  5120.             int wrk;
  5121.  
  5122.  
  5123.             j = buff;           /* point to top of our buffer */
  5124.  
  5125.  
  5126.             k = sizeof(buff);        /* set chars needed to fill */
  5127.  
  5128.             do
  5129.  
  5130.             {
  5131.  
  5132.                  wrk = lc_gets(port, j, k);
  5133.  
  5134.                  if (wrk != -1) /* got something ? */
  5135.  
  5136.                  {
  5137.  
  5138.                       j += wrk; /* bump buffer pointer */
  5139.  
  5140.                       k -= wrk; /* decrement  chars req'd */
  5141.  
  5142.  
  5143.                  }
  5144.  
  5145.             } until (k <= 0);
  5146.  
  5147.  
  5148.             RETURN VALUES
  5149.  
  5150.  
  5151.             Returns the count of characters transferred into buffer, or -1 if
  5152.  
  5153.             an error occurs. 
  5154.  
  5155.  
  5156.  
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.  
  5163.  
  5164.  
  5165.  
  5166.  
  5167.  
  5168.  
  5169.  
  5170.                                             48
  5171.  
  5172.  
  5173.  
  5174.  
  5175.  
  5176.        lc_puts
  5177.  
  5178.  
  5179.  
  5180.             SUMMARY
  5181.  
  5182.             #include <litecomm.h>
  5183.  
  5184.  
  5185.             int lc_puts(port, buff, cnt)
  5186.  
  5187.             unsigned port;
  5188.  
  5189.             char *buff;
  5190.  
  5191.             int cnt;
  5192.  
  5193.  
  5194.             DESCRIPTION
  5195.  
  5196.             Place a stream of, at most, 
  5197.                                         
  5198.                                         cnt characters into the serial port's
  5199.  
  5200.             output buffer. Any required parity will be supplied by the serial
  5201.  
  5202.             port itself.
  5203.  
  5204.  
  5205.  
  5206.  
  5207.             Example
  5208.             Example
  5209.             Example
  5210.  
  5211.             char * j
  5212.  
  5213.             int j;
  5214.  
  5215.             int sent;
  5216.  
  5217.                  j = buff;
  5218.  
  5219.                  k = sizeof(buff)
  5220.  
  5221.  
  5222.                  do
  5223.  
  5224.                  {
  5225.  
  5226.                       sent = lc_puts(port, j, k);
  5227.  
  5228.                       if (sent > 0)
  5229.  
  5230.                       {
  5231.  
  5232.                            j += sent;
  5233.  
  5234.                            k -= sent;
  5235.  
  5236.                       }
  5237.  
  5238.  
  5239.                  } until (k <= 0);
  5240.  
  5241.  
  5242.             RETURN VALUES
  5243.  
  5244.  
  5245.             Returns the number of characters placed into the buffer. Note
  5246.  
  5247.             that this does not guarantee that the characters have been sent.
  5248.  
  5249.             The number of characters transferred into the output buffer may
  5250.  
  5251.             be less than the actual request. Returns 0 if any error occurs,
  5252.  
  5253.             or if there is no room in the port's buffer.
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.                                             49
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.        lc_flush
  5276.  
  5277.  
  5278.  
  5279.             SUMMARY
  5280.  
  5281.             #include <litecomm.h>
  5282.  
  5283.  
  5284.             int lc_tflush(port)
  5285.  
  5286.             int lc_rflush(port)
  5287.  
  5288.             int lc_flshtrue(port, ch)
  5289.  
  5290.             int lc_nflush(port, cnt)
  5291.  
  5292.  
  5293.             unsigned port;
  5294.  
  5295.             char ch;
  5296.  
  5297.             int cnt;
  5298.  
  5299.             DESCRIPTION
  5300.  
  5301.  
  5302.             The lc_?flush functions remove characters from the specified
  5303.  
  5304.             buffer and discard them; untransmitted characters in the transmit
  5305.  
  5306.             buffer are NEVER sent; unprocessed characters in the receive
  5307.  
  5308.             buffer are lost.  Do not try to use the lc_tflush to force char-
  5309.  
  5310.             acters to be transmitted.  The tflush function unconditionally
  5311.  
  5312.             empties the transmit buffer, discarding any unsent characters.
  5313.  
  5314.                lc_tflush empties the port's transmit buffer immediately.
  5315.  
  5316.                lc_rflush empties the port's receive and status buffers im-
  5317.  
  5318.                mediately.
  5319.  
  5320.  
  5321.                lc_flshtrue will continually dispose of received characters
  5322.  
  5323.                until the function finds the character ch. Use caution with
  5324.  
  5325.                this one since it does not detect port number errors, and may
  5326.  
  5327.                appear to seize the system.
  5328.  
  5329.                lc_nflush flushes, at most, cnt characters from the port's re-
  5330.  
  5331.                ceive and status buffers.
  5332.  
  5333.             RETURN VALUES
  5334.  
  5335.             lc_flshtrue returns no values. lc_tflush and lc_rflush return 0
  5336.  
  5337.             if successful and -1 if an error occurs. lc_nflush returns the
  5338.  
  5339.             number of characters flushed from the receive buffer or 0 when
  5340.  
  5341.             there are no characters to flush, or when an error occurs.
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.  
  5354.  
  5355.  
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361.  
  5362.  
  5363.                                             50
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.        lc_sbrk
  5370.  
  5371.  
  5372.  
  5373.             SUMMARY
  5374.  
  5375.             #include <litecomm.h>
  5376.  
  5377.  
  5378.             int lc_sbrk(port)
  5379.  
  5380.             lc_gotbrk(port)
  5381.  
  5382.             unsigned port;
  5383.  
  5384.             DESCRIPTION
  5385.  
  5386.  
  5387.             lc_sbrk() generates a BREAK signal using a particular character-
  5388.  
  5389.             istic of the 8250 UART family to generate an accurate BREAK at
  5390.  
  5391.             any baud rate.  BREAKs generated in this manner are timed based
  5392.  
  5393.             upon the baud rate at which the 8250 is currently initialized.
  5394.  
  5395.             This function may or may not work correctly with other than the
  5396.  
  5397.             actual 8250 UART or its relatives.
  5398.  
  5399.             RETURN VALUES
  5400.  
  5401.             lc_gotbrk returns a nonzero value if a break signal has been re-
  5402.  
  5403.             ceived on the specified port.  It returns zero otherwise.
  5404.  
  5405.             lc_sbrk Returns 0 if successful. Returns -1 if the port is not
  5406.  
  5407.             active.
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.  
  5420.  
  5421.  
  5422.  
  5423.  
  5424.  
  5425.  
  5426.  
  5427.  
  5428.  
  5429.  
  5430.  
  5431.  
  5432.  
  5433.  
  5434.  
  5435.  
  5436.  
  5437.  
  5438.  
  5439.  
  5440.  
  5441.  
  5442.  
  5443.  
  5444.                                             51
  5445.  
  5446.  
  5447.  
  5448.  
  5449.  
  5450.        newtimer_s
  5451.  
  5452.  
  5453.  
  5454.             SUMMARY
  5455.  
  5456.             include "lctime.h";
  5457.  
  5458.  
  5459.             void newtimer_s(et, sec);
  5460.  
  5461.             EVENT *et;
  5462.  
  5463.             unsigned sec;
  5464.  
  5465.  
  5466.  
  5467.             int check_timer(et);
  5468.  
  5469.             EVENT ev;
  5470.  
  5471.             DESCRIPTION
  5472.  
  5473.             The newtimer_s function creates an 'event timer' that will expire
  5474.  
  5475.             in sec seconds.  This function relies upon the calculation of an
  5476.  
  5477.             absolute time value and does not tie into any system interrupt,
  5478.  
  5479.             permitting as many independent timeout timers as required by your
  5480.  
  5481.             application.
  5482.  
  5483.  
  5484.             The check_timer function examines the contents of an event timer
  5485.  
  5486.             created by newtimer_s with respect to the current date and time,
  5487.  
  5488.             and indicates whether the timer has expired.
  5489.  
  5490.             Do not attempt to use check_timer against a variable that was not
  5491.  
  5492.             set by newtimer_s.  If you do so, the results are unpredictable
  5493.  
  5494.             and may result in a seeming system hang.
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.                                             52
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.             Example
  5536.             Example
  5537.             Example
  5538.  
  5539.             EVENT cdtimer;
  5540.  
  5541.  
  5542.  
  5543.             newtimer_s(&cdtimer, 30); /* 30 second timer */
  5544.  
  5545.             while( ! check_timer(cdtimer))
  5546.  
  5547.                  if (check_for_call(port) > 0)
  5548.  
  5549.                  {
  5550.  
  5551.                       cprintf("Incoming call\r\n");
  5552.  
  5553.                       return(1);
  5554.  
  5555.  
  5556.                  }
  5557.  
  5558.                  cprintf("No calls in 30 seconds\r\n");
  5559.  
  5560.             return(0);
  5561.  
  5562.  
  5563.  
  5564.             RETURN VALUES
  5565.  
  5566.             The newtimer_s function returns no value but initializes a
  5567.  
  5568.             structure that represents a point in time sec seconds from the
  5569.  
  5570.             time that newtimer_s was called. The check_timer function returns
  5571.  
  5572.             a nonzero value if the specified event timer has expired, a value
  5573.  
  5574.             of zero otherwise.
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.                                             53
  5610.  
  5611.  
  5612.  
  5613.  
  5614.  
  5615.        BBS SUPPORT FUNCTIONS
  5616.  
  5617.  
  5618.  
  5619.        INTRODUCTION
  5620.  
  5621.             In this chapter, we discuss a set of utility functions that were
  5622.  
  5623.             originally developed as a part of a BBS package with one of our
  5624.  
  5625.             registered users.  Not only are they useful, in and of them-
  5626.  
  5627.             selves, but they also act as examples of using the LiteComm
  5628.  
  5629.             ToolBox in situations that puzzle some users.
  5630.  
  5631.  
  5632.             ADDITIONAL NOTES
  5633.  
  5634.             The use of any of the functions that follow in this section re-
  5635.  
  5636.             quire that you define, in your code, three modem setup strings
  5637.  
  5638.             with the names MODEMSET0, MODEMSET1, and MODEMSET2, and must be
  5639.  
  5640.             pointers to characters.  In addition, they must be defined as
  5641.  
  5642.             global variables, and must be public (i.e., not static). Below,
  5643.  
  5644.             we show one way to do this.
  5645.  
  5646.  
  5647.  
  5648.  
  5649.             Example
  5650.             Example
  5651.             Example
  5652.  
  5653.             char istrng0[] = "ATZ\r";
  5654.  
  5655.             char istrng1] = "ATT E0 V0 X1 M1\r";
  5656.  
  5657.             char istrng2[] = "ATS0=1\r";
  5658.  
  5659.             char *MODEMSET0;
  5660.  
  5661.             char *MODEMSET1;
  5662.  
  5663.             char *MODEMSET2;
  5664.  
  5665.  
  5666.             void main(void)
  5667.  
  5668.             {
  5669.  
  5670.                  ...
  5671.  
  5672.                  MODEMSET0 = &istrng0[0];
  5673.  
  5674.                  MODEMSET1 = &istrng1[0];
  5675.  
  5676.                  MODEMSET2 = &istrng2[0];
  5677.  
  5678.                  ...
  5679.  
  5680.  
  5681.             }
  5682.  
  5683.  
  5684.             Experienced C programmers will readily recognize that this is not
  5685.  
  5686.             necessarily the best approach.  But it does serve to illustrate
  5687.  
  5688.             clearly the ideas involved.  Be sure to define  MODEMSET0, 1, and
  5689.  
  5690.             2 as pointers to characters as shown above, and NOT as arrays.
  5691.  
  5692.             It is a fine destinction in C, but an important one.
  5693.  
  5694.  
  5695.  
  5696.  
  5697.  
  5698.  
  5699.  
  5700.  
  5701.  
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.                                             54
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.        check_for_call
  5715.  
  5716.  
  5717.  
  5718.             SUMMARY
  5719.  
  5720.             include "lcbbs.h";
  5721.  
  5722.  
  5723.             int check_for_call(port)
  5724.  
  5725.             unsigned port;
  5726.  
  5727.             DESCRIPTION
  5728.  
  5729.             This function checks the status of the specified port to deter-
  5730.  
  5731.             mine whether (1) there is an incoming call and (2) waits for up
  5732.  
  5733.             to 30 seconds for carrier to be established with the caller if
  5734.  
  5735.             the phone rang.  Please note that this function relies upon, in
  5736.  
  5737.             part, the HAYES command set.  Use with other than HAYES- compat-
  5738.  
  5739.             ible modems may result in unexpected hangs or other, unpredict-
  5740.  
  5741.             able results.  The function assumes that the modem parameters
  5742.  
  5743.             have been set in the manner described in the reset_modem func-
  5744.  
  5745.             tion.
  5746.  
  5747.  
  5748.             In the event that a wrong number call is received, check_for_call
  5749.  
  5750.             will automatically disconnect by lowering  the DTR(Data Terminal
  5751.  
  5752.             Ready) signal momentarily, then automatically call the reset_mo-
  5753.  
  5754.             dem function.  See the notes at the beginning of this chapter,
  5755.  
  5756.             and in the discussion of the reset_modem function.  This method
  5757.  
  5758.             of disconnecting, while absolute, will only work correctly if you
  5759.  
  5760.             HAVE NOT set your modem to ignore the DTR signals, as is possible
  5761.  
  5762.             with some modems.  Please consult your modem's documentation for
  5763.  
  5764.             additional detail.
  5765.  
  5766.             RETURN VALUES
  5767.  
  5768.             If the phone was not ringing, the function returns a value of
  5769.  
  5770.             zero.  If detects a ring was detected, but does not detect
  5771.  
  5772.             carrier within 30 seconds, the function will return a value of -1
  5773.  
  5774.             after forcing a disconnect and resetting the modem.  Otherwise,
  5775.  
  5776.             the function returns the numeric result code, in integer form.
  5777.  
  5778.             It is the programmer's responsibility to interpret and act upon
  5779.  
  5780.             the result code.  For the function to work properly, the modem
  5781.  
  5782.             must be set to return numeric result codes rather than word re-
  5783.  
  5784.             sult codes.
  5785.  
  5786.  
  5787.  
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.  
  5800.  
  5801.  
  5802.  
  5803.  
  5804.  
  5805.                                             55
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.        get_modem_reply
  5812.  
  5813.  
  5814.  
  5815.             SUMMARY
  5816.  
  5817.             include "lcbbs.h"
  5818.  
  5819.  
  5820.             int get_modem_reply(port)
  5821.  
  5822.             unsigned port;
  5823.  
  5824.             DESCRIPTION
  5825.  
  5826.             The get_modem_reply function is intended for use after a command
  5827.  
  5828.             has been issued to a HAYES compatible modem.  To operate proper-
  5829.  
  5830.             ly, the modem must be set to return numeric responses rather than
  5831.  
  5832.             word responses.  The function returns to the caller when one of
  5833.  
  5834.             the following occurs:
  5835.  
  5836.  
  5837.                No response from the modem within 1 second.
  5838.  
  5839.                More than 2 response characters received before a <CR> is de-
  5840.  
  5841.                tected.
  5842.  
  5843.                A <CR> is received from the modem.  
  5844.  
  5845.  
  5846.             Due to the internal logic employed, the programmer should call
  5847.  
  5848.             this function, or purge the receive buffer, after each command
  5849.  
  5850.             sent to the modem.  Failure to do so will result in improper in-
  5851.  
  5852.             terpretation of the result codes returned.
  5853.  
  5854.             RETURN VALUES
  5855.  
  5856.             Returns a value of -1 if there is no response from the modem
  5857.  
  5858.             within 1 second.  Otherwise returns the integer result code.  If
  5859.  
  5860.             the modem has not been set to return numeric result codes, the
  5861.  
  5862.             results are unpredictable.
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.  
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.  
  5882.  
  5883.  
  5884.  
  5885.  
  5886.  
  5887.  
  5888.  
  5889.  
  5890.  
  5891.  
  5892.                                             56
  5893.  
  5894.  
  5895.  
  5896.  
  5897.  
  5898.        reset_modem
  5899.  
  5900.  
  5901.  
  5902.             SUMMARY
  5903.  
  5904.             include "lcbbs.h"
  5905.  
  5906.  
  5907.             int reset_modem(port)
  5908.  
  5909.             unsigned port;
  5910.  
  5911.             DESCRIPTION
  5912.  
  5913.             The reset_modem function initializes the modem to a known state,
  5914.  
  5915.             suitable for use with the other bbs functions, and based upon a
  5916.  
  5917.             set of initialization strings provided by the user's program.
  5918.  
  5919.             See the notes at the beginning of this chapter for additional
  5920.  
  5921.             information regarding the way that this must be done. 
  5922.  
  5923.  
  5924.             Because the modem-related functions in this section make certain
  5925.  
  5926.             assumptions about the modem, your initialization strings should
  5927.  
  5928.             include, at a minimum, the following:
  5929.  
  5930.                No command echo
  5931.  
  5932.                Detect carrier
  5933.  
  5934.  
  5935.                Return numeric result codes
  5936.  
  5937.                Answer the phone on the first ring (if you need to use the
  5938.  
  5939.                check_for_call function)
  5940.  
  5941.             A sample set of initialization strings is shown at the start of
  5942.  
  5943.             this chapter. If you require any additional information on these
  5944.  
  5945.             or related options, please consult your modem's documentation.
  5946.  
  5947.             RETURN VALUES
  5948.  
  5949.  
  5950.             The reset_modem function returns the same result code as those
  5951.  
  5952.             specified for get_modem_reply.
  5953.  
  5954.  
  5955.  
  5956.  
  5957.  
  5958.  
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.  
  5971.  
  5972.  
  5973.  
  5974.  
  5975.  
  5976.  
  5977.  
  5978.  
  5979.  
  5980.                                             57
  5981.  
  5982.  
  5983.  
  5984.  
  5985.  
  5986.        disconnect
  5987.  
  5988.  
  5989.  
  5990.             SUMMARY
  5991.  
  5992.             include "lcbbs.h"
  5993.  
  5994.  
  5995.             void disconnect(port)
  5996.  
  5997.             unsigned port;
  5998.  
  5999.             DESCRIPTION
  6000.  
  6001.             The disconnect forcibly disconnects the modem from the telephone
  6002.  
  6003.             line by lowering the DTR signal momentarily.  You must be certain
  6004.  
  6005.             that your modem IS NOT set to ignore the DTR signal for the
  6006.  
  6007.             function to work properly.
  6008.  
  6009.  
  6010.             RETURN VALUES
  6011.  
  6012.             Disconnect returns no values.
  6013.  
  6014.  
  6015.  
  6016.  
  6017.  
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.  
  6030.  
  6031.  
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.                                             58
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.        HAYES MODEM FUNCTIONS
  6062.  
  6063.  
  6064.  
  6065.             Note:
  6066.             Note:
  6067.             Note:When using the following functions, you must include the
  6068.  
  6069.             file litehcm.h in your program. litehcm.h automatically includes
  6070.  
  6071.             the litecomm.h header file.
  6072.  
  6073.  
  6074.             FUNCTIONS
  6075.  
  6076.                  lch_codeset
  6077.  
  6078.                  lch_dial
  6079.  
  6080.                  lch_fduplex
  6081.  
  6082.                  lch_hduplex
  6083.  
  6084.  
  6085.                  lch_greg
  6086.  
  6087.                  lch_sreg
  6088.  
  6089.                  lch_offcarr
  6090.  
  6091.                  lch_oncarr
  6092.  
  6093.  
  6094.                  lch_offecho
  6095.  
  6096.                  lch_onecho
  6097.  
  6098.                  lch_hook
  6099.  
  6100.                  lch_redo
  6101.  
  6102.  
  6103.                  lch_numres
  6104.  
  6105.                  lch_wrdres
  6106.  
  6107.                  lch_codesoff
  6108.  
  6109.                  lch_codeson
  6110.  
  6111.  
  6112.                  lch_pulse
  6113.  
  6114.                  lch_tone
  6115.  
  6116.                  lch_speaker
  6117.  
  6118.                  _retset
  6119.  
  6120.                  _rettype
  6121.  
  6122.  
  6123.             SUMMARY
  6124.  
  6125.             #include <litehcm.h>
  6126.  
  6127.             int lch_codeset(port,mode)
  6128.  
  6129.             int lch_dial(port,dstr)
  6130.  
  6131.  
  6132.             int lch_fduplex(port)
  6133.  
  6134.             int lch_hduplex(port)
  6135.  
  6136.             int lch_greg(port,reg)
  6137.  
  6138.             int lch_sreg(port,reg,value)
  6139.  
  6140.  
  6141.             int lch_offcarr(port)
  6142.  
  6143.             int lch_oncarr(port)
  6144.  
  6145.             int lch_offecho(port)
  6146.  
  6147.             int lch_onecho(port)
  6148.  
  6149.  
  6150.             int lch_hook(port,hmode)
  6151.  
  6152.             int lch_redo(port)
  6153.  
  6154.             int lch_numres(port)
  6155.  
  6156.             int lch_wrdres(port)
  6157.  
  6158.  
  6159.             int lch_codesoff(port)
  6160.  
  6161.             int lch_codeson(port)
  6162.  
  6163.  
  6164.                                             59
  6165.  
  6166.  
  6167.  
  6168.  
  6169.  
  6170.             int lch_pulse(port)
  6171.  
  6172.             int lch_tone(port)
  6173.  
  6174.             int lch_speaker(port,spkmode)
  6175.  
  6176.             int _retset()
  6177.  
  6178.  
  6179.             int _rettype()
  6180.  
  6181.             unsigned port;
  6182.  
  6183.             unsigned mode;
  6184.  
  6185.             char *dstr;
  6186.  
  6187.  
  6188.             unsigned reg;
  6189.  
  6190.             int value;
  6191.  
  6192.             unsigned hmode;
  6193.  
  6194.             unsigned spkmode; 
  6195.  
  6196.  
  6197.             DESCRIPTION
  6198.  
  6199.             The values to be used with mode, hmode, and spkmode are defined
  6200.  
  6201.             symbolically in the #include file, litehcm.h.
  6202.  
  6203.             The lch_codeset
  6204.                 lch_codeset
  6205.                 lch_codeset function allows you to change the set of codes
  6206.  
  6207.             returned by the modem when an action is specified.
  6208.  
  6209.  
  6210.  
  6211.             lch_dial
  6212.             lch_dial
  6213.             lch_dial instructs the modem to dial the number contained in
  6214.  
  6215.             dstr. Do not include the dialing (ATD) prefix, or the trailing
  6216.  
  6217.             <\r>. These are provided by the function. You may include non-
  6218.  
  6219.             numeric characters that are acceptable to your modem, since the
  6220.  
  6221.             function does not check the contents of dstr. The dialing is in
  6222.  
  6223.             the last known dialing mode, either pulse or tone. If you use the
  6224.  
  6225.             lch_pulse or lch_tone functions, then dialing will be done in the
  6226.  
  6227.             mode that was last correctly enabled. If you have not exercised
  6228.  
  6229.             these functions, then dialing occurs in the modems default or
  6230.  
  6231.             power-up mode.
  6232.  
  6233.  
  6234.             The lch_hduplex
  6235.                 lch_hduplex
  6236.                 lch_hduplex and lch_fduplex 
  6237.                                 lch_fduplex 
  6238.                                 lch_fduplex functions place the modem into
  6239.  
  6240.             local echo and remote echo modes respectively.
  6241.  
  6242.  
  6243.  
  6244.             The lch_greg
  6245.                 lch_greg
  6246.                 lch_greg function requests that the modem report the current
  6247.  
  6248.             value of S-register reg. Reg must be in the range 0 to 13. Use
  6249.  
  6250.             the lc_gets, or similar function, to retrieve the modem's re-
  6251.  
  6252.             sponse. Specifying a register outside the 0 to 13 range will
  6253.  
  6254.             cause a return of -1.
  6255.  
  6256.  
  6257.             lch_sreg
  6258.             lch_sreg
  6259.             lch_sreg is the companion to lch_greg, with the same restric-
  6260.  
  6261.             tions. Sets the S-register reg to the value contained in value.
  6262.  
  6263.             If value contains -1, then the register is reset to its default
  6264.  
  6265.             (power-up) value. The function checks the value to be certain
  6266.  
  6267.             that it is within the limits specified for the particular regis-
  6268.  
  6269.             ter, and returns a value of -1 if the value is outside the
  6270.  
  6271.             predefined limits.
  6272.  
  6273.  
  6274.             lch_offcarr
  6275.             lch_offcarr
  6276.             lch_offcarr enables modem carrier detect, but disables the mo-
  6277.  
  6278.             dem's carrier signal. The lch_oncarr companion enables both car-
  6279.  
  6280.             rier detect and the modem's carrier signal. When lch_offcarr is
  6281.  
  6282.             used the modem will receive data but will be unable to send data.
  6283.  
  6284.  
  6285.  
  6286.                                             60
  6287.  
  6288.  
  6289.  
  6290.  
  6291.  
  6292.             The lch_offecho
  6293.                 lch_offecho
  6294.                 lch_offecho and lch_onecho
  6295.                                 lch_onecho
  6296.                                 lch_onecho functions determine whether com-
  6297.  
  6298.             mands sent to the modem are echoed back to the sending program.
  6299.  
  6300.             With echo turned off, the modem will continue to accept commands,
  6301.  
  6302.             but will not try to redisplay the command's characters.
  6303.  
  6304.  
  6305.             lch_hook
  6306.             lch_hook
  6307.             lch_hook allows you to control the status of the modem's tele-
  6308.  
  6309.             phone line connection. See your modem's documentation and the
  6310.  
  6311.             include file for additional information.
  6312.  
  6313.  
  6314.  
  6315.             The lch_redo
  6316.                 lch_redo
  6317.                 lch_redo function instructs the modem to repeat the last
  6318.  
  6319.             command sequence executed. Generally, this function is of great-
  6320.  
  6321.             est value in redialing numbers that are busy, although its use is
  6322.  
  6323.             not restricted to that.
  6324.  
  6325.  
  6326.             The way in which your modem responds to commands is determined,
  6327.  
  6328.             in part, by the lch_wrdres
  6329.                             lch_wrdres
  6330.                             lch_wrdres and lch_numres
  6331.                                            lch_numres
  6332.                                            lch_numres functions. If you call
  6333.  
  6334.             lch_wrdres, then modem responses use the English language re-
  6335.  
  6336.             sponse codes, e.g,. CONNECT or OK. Calling lch_numres instructs
  6337.  
  6338.             the modem to respond with code numbers only from the currently
  6339.  
  6340.             selected response set, see the lch_codeset function.
  6341.  
  6342.  
  6343.  
  6344.             You may use the functions lch_codeson
  6345.                                       lch_codeson
  6346.                                       lch_codeson and lch_codesoff
  6347.                                                       lch_codesoff
  6348.                                                       lch_codesoff to specify
  6349.  
  6350.             whether you want your modem to send back response codes when it
  6351.  
  6352.             receives a command string. In a sense, these act as companions to
  6353.  
  6354.             the lch_xxxecho functions above.
  6355.  
  6356.  
  6357.             Use the lch_speaker
  6358.                     lch_speaker
  6359.                     lch_speaker function to control the modem's internal
  6360.  
  6361.             speaker, if it has one. See litehcm.h for the applicable codes.
  6362.  
  6363.  
  6364.  
  6365.             The _retset
  6366.                 _retset
  6367.                 _retset and _rettype
  6368.                             _rettype
  6369.                             _rettype functions return, respectively, the last
  6370.  
  6371.             known command set (lch_codeset) and last known result type
  6372.  
  6373.             (lch_wrdres, lch_numres). These functions (_retset, _rettype) are
  6374.  
  6375.             only of value when used with the companion functions.
  6376.  
  6377.  
  6378.             GENERAL REMARKS
  6379.  
  6380.             Several considerations are in order if you intend to use the
  6381.  
  6382.             Hayes ToolBox functions.
  6383.  
  6384.  
  6385.  
  6386.             You are responsible for checking the return codes from the modem
  6387.  
  6388.             once you have given modem a command. To make the task easier, we
  6389.  
  6390.             suggest that you turn OFF command echo. Then you won't have to
  6391.  
  6392.             worry about separating commands from responses. Finally turn ON
  6393.  
  6394.             numeric responses to make the interpretation of result codes
  6395.  
  6396.             easier and faster.
  6397.  
  6398.  
  6399.             Note:
  6400.             Note:
  6401.             Note:Be sure that you allow  adequate time between commands for
  6402.  
  6403.             the modem to process the command and respond. Failure to observe
  6404.  
  6405.             this rule may result in commands being misinterpreted or "lost."
  6406.  
  6407.             You can monitor the number of characters in the receive buffer to
  6408.  
  6409.             help you with the timing. Or alternatively, check the response
  6410.  
  6411.             after each command. The latter approach is more in line with what
  6412.  
  6413.             we believe to be good programming practice. 
  6414.  
  6415.  
  6416.                                             61
  6417.  
  6418.  
  6419.  
  6420.  
  6421.  
  6422.  
  6423.             RETURN VALUES
  6424.  
  6425.             All functions return a value of -1 if a port or other error oc-
  6426.  
  6427.             curs, zero otherwise.
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.                                             62
  6483.  
  6484.  
  6485.  
  6486.                                           INDEX
  6487.                                           INDEX
  6488.                                           INDEX
  6489.  
  6490.  
  6491.             _lc_error, 18                       get_modem_reply, 56, 57
  6492.  
  6493.             _portchg, 12, 19                    handshaking, 7, 8, 9, 10, 18,
  6494.  
  6495.             _retset, 59, 61                     30, 32, 33
  6496.  
  6497.             _rettype, 59, 61                    HAYES, 55, 56, 59, 61
  6498.  
  6499.                                                 HAYES MODEM FUNCTIONS, 59
  6500.  
  6501.             16450, 3, 9
  6502.  
  6503.             16550, 3                            identification, 4, 6
  6504.  
  6505.             8250, 3, 5, 6, 9, 10, 12, 51        INSTALL, 15
  6506.  
  6507.             8259, 11, 12, 13                    INSTALLATION, 15
  6508.  
  6509.                                                 interrupt, 4, 5, 6, 9, 10,
  6510.  
  6511.             Alignment, 10                       11, 12, 13, 14, 16, 19, 20,
  6512.  
  6513.             ASP, 1                              22, 28, 30, 32, 33, 52
  6514.  
  6515.             baud, 5, 6, 7, 11, 14, 20,
  6516.  
  6517.             23, 51                              IRQ, 11, 12, 13, 19
  6518.  
  6519.             BBS SUPPORT FUNCTIONS, 54           ISA, 4
  6520.  
  6521.                                                 ISR, 4, 5
  6522.  
  6523.             BIOS, 12, 14                        lc_clearhwflow, 38, 39
  6524.  
  6525.             BREAK, 5, 8, 51
  6526.  
  6527.             buffer, 20, 25, 29, 34, 42,         lc_clrmdm, 30, 32, 33
  6528.  
  6529.             46, 47, 48, 49, 50, 56, 61          lc_estat, 28, 43
  6530.  
  6531.             buss, 4, 13                         lc_flush, 50
  6532.  
  6533.                                                 lc_get, 42, 43, 44, 46, 48
  6534.  
  6535.             C, 14, 15, 16, 18, 22, 54
  6536.  
  6537.             chain, 13                           lc_gets, 48, 60
  6538.  
  6539.             check_for_call, 17, 55, 57          lc_getstat, 42, 43, 44
  6540.  
  6541.             COM1, 1, 5, 12, 14                  lc_getw, 29
  6542.  
  6543.             COM2, 8, 11, 12, 14                 lc_got, 26, 27
  6544.  
  6545.                                                 lc_gothwstop, 38, 39, 41
  6546.  
  6547.             COM3, 11, 12, 13, 14, 19
  6548.  
  6549.             COM4, 1, 11, 12, 13, 14, 19         lc_gotxoff, 34, 35, 37
  6550.  
  6551.             comm_close, 20, 22, 32              lc_icnt, 25
  6552.  
  6553.             comm_opn, 11, 12, 20, 22, 23,       lc_mstat, 17, 26, 27
  6554.  
  6555.             24, 30                              lc_ocnt, 25
  6556.  
  6557.  
  6558.             comm_setup, 23                      lc_peek, 46
  6559.  
  6560.             control, 3, 4, 5, 7, 8, 9,          lc_put, 47
  6561.  
  6562.             10, 11, 16, 18, 20, 22, 24,         lc_puthwstop, 38, 39, 40
  6563.  
  6564.             30, 32, 33, 34, 35, 36, 37,         lc_puts, 49
  6565.  
  6566.             38, 39, 40, 41, 61
  6567.  
  6568.             debuggers, 14                       lc_putxoff, 34, 35, 36, 37
  6569.  
  6570.             Digiboard, 12                       lc_sbrk, 51
  6571.  
  6572.                                                 lc_setdtr, 30, 31
  6573.  
  6574.             disconnect, 55, 58                  lc_sethwflow, 38, 39, 40, 41
  6575.  
  6576.             divisor, 5
  6577.  
  6578.             DTR, 7, 10, 20, 21, 22, 30,         lc_setmdm, 10, 30, 31, 32, 33
  6579.  
  6580.             31, 32, 33, 38, 55, 58              lc_setrts, 30, 31
  6581.  
  6582.             echo, 57, 60, 61                    lc_setxoff, 34, 35, 36, 37
  6583.  
  6584.                                                 lc_setxon, 34, 35, 36, 37
  6585.  
  6586.             EISA, 4
  6587.  
  6588.             ERROR, 5, 6, 10, 11, 18, 21,        lc_togmdm, 30, 32, 33
  6589.  
  6590.             22, 23, 24, 25, 26, 28, 35,         lc_vport, 24
  6591.  
  6592.             36, 37, 38, 39, 40, 41, 43,         lc_xoff, 34, 35, 36, 37, 38
  6593.  
  6594.             44, 48, 49, 50, 62                  lch_codeset, 59, 60, 61
  6595.  
  6596.             event, 52, 53, 55                   lch_codesoff, 59, 61
  6597.  
  6598.             flow control, 11, 18, 34, 35,
  6599.  
  6600.             36, 37, 38, 39, 40, 41              lch_codeson, 59, 61
  6601.  
  6602.  
  6603.  
  6604.                                           INDEX
  6605.                                           INDEX
  6606.                                           INDEX
  6607.  
  6608.  
  6609.             lch_dial, 59, 60                    status, 5, 6, 7, 8, 11, 26,
  6610.  
  6611.             lch_fduplex, 59, 60                 27, 28, 31, 42, 43, 44, 48,
  6612.  
  6613.             lch_greg, 59, 60                    50, 55, 61
  6614.  
  6615.             lch_hduplex, 59, 60                 TSR, 16
  6616.  
  6617.                                                 UART, 3, 9, 12, 51
  6618.  
  6619.             lch_hook, 59, 61                    USECTS, 38
  6620.  
  6621.             lch_numres, 59, 61
  6622.  
  6623.             lch_offcarr, 59, 60                 USEDSR, 38
  6624.  
  6625.             lch_offecho, 59, 61                 USEDTR, 38
  6626.  
  6627.                                                 USERTS, 38
  6628.  
  6629.             lch_onecho, 59, 61                  vector, 4, 11, 12, 13, 19
  6630.  
  6631.             lch_redo, 59, 61
  6632.  
  6633.             lch_speaker, 59, 61                 wait, 42, 43, 44, 45
  6634.  
  6635.             lch_sreg, 59, 60                    warning, 9, 10
  6636.  
  6637.                                                 warranty, 2
  6638.  
  6639.             lch_wrdres, 59, 61                  workarounds, 9
  6640.  
  6641.             length, 7, 20
  6642.  
  6643.             libraries, 15, 16                   Xmodem, 2
  6644.  
  6645.             license, 2                          Xmodem-1K, 2
  6646.  
  6647.                                                 XON-XOFF, 18, 34, 37
  6648.  
  6649.             memory, 4, 9, 10, 12, 20, 22        YModem, 2
  6650.  
  6651.             micro-channel, 4
  6652.  
  6653.             multitasking, 16, 17                ZModem, 2
  6654.  
  6655.             newtimer_s, 52, 53
  6656.  
  6657.             NULL, 24, 48
  6658.  
  6659.  
  6660.             open, 8, 9, 10, 11, 12, 14,
  6661.  
  6662.             20, 21, 22, 25, 26, 28
  6663.  
  6664.             OUT2, 7, 30, 32, 33
  6665.  
  6666.             parity, 7, 10, 20, 23, 28,
  6667.  
  6668.             42, 46, 49
  6669.  
  6670.             PC, 3, 4, 9, 10, 11, 12, 13
  6671.  
  6672.  
  6673.             port, 3, 4, 5, 6, 7, 8, 9,
  6674.  
  6675.             10, 11, 12, 13, 14, 16, 19,
  6676.  
  6677.             20, 21, 22, 23, 24, 25, 26,
  6678.  
  6679.             27, 28, 29, 30, 31, 32, 33,
  6680.  
  6681.             34, 35, 36, 37, 38, 39, 40,
  6682.  
  6683.             41, 42, 43, 44, 45, 46, 47,
  6684.  
  6685.             48, 49, 50, 51, 55, 56, 57,
  6686.  
  6687.             58, 60, 62
  6688.  
  6689.             priority, 4, 13, 19
  6690.  
  6691.             PS/2, 13, 16
  6692.  
  6693.             purge, 42, 43, 45, 56
  6694.  
  6695.  
  6696.             register, 5, 6, 7, 8, 12, 43,
  6697.  
  6698.             60
  6699.  
  6700.             Registration, 1, 2
  6701.  
  6702.             reset_modem, 55, 57
  6703.  
  6704.             RI, , 17, 44
  6705.  
  6706.  
  6707.             RTS, 7, 10, 20, 22, 30, 31,
  6708.  
  6709.             32, 33, 38
  6710.  
  6711.             Shareware, 1, 2, 16
  6712.          ----------------end-of-author's-documentation---------------
  6713.  
  6714.                          Software Library Information:
  6715.  
  6716.                     This disk copy provided as a service of
  6717.  
  6718.                            Public (software) Library
  6719.  
  6720.          We are not the authors of this program, nor are we associated
  6721.          with the author in any way other than as a distributor of the
  6722.          program in accordance with the author's terms of distribution.
  6723.  
  6724.          Please direct shareware payments and specific questions about
  6725.          this program to the author of the program, whose name appears
  6726.          elsewhere in  this documentation. If you have trouble getting
  6727.          in touch with the author,  we will do whatever we can to help
  6728.          you with your questions. All programs have been tested and do
  6729.          run.  To report problems,  please use the form that is in the
  6730.          file PROBLEM.DOC on many of our disks or in other written for-
  6731.          mat with screen printouts, if possible.  PsL cannot debug pro-
  6732.          programs over the telephone, though we can answer questions.
  6733.  
  6734.          Disks in the PsL are updated  monthly,  so if you did not get
  6735.          this disk directly from the PsL, you should be aware that the
  6736.          files in this set may no longer be the current versions. Also,
  6737.          if you got this disk from another vendor and are having prob-
  6738.          lems,  be aware that  some files may have become corrupted or
  6739.          lost by that vendor. Get a current, working disk from PsL.
  6740.  
  6741.          For a copy of the latest monthly software library newsletter
  6742.          and a list of the 3,000+ disks in the library, call or write
  6743.  
  6744.                            Public (software) Library
  6745.                                P.O.Box 35705 - F
  6746.                             Houston, TX 77235-5705
  6747.  
  6748.                                  Orders only:
  6749.                                 1-800-2424-PSL
  6750.                               MC/Visa/AmEx/Discover
  6751.  
  6752.                           Outside of U.S. or in Texas
  6753.                           or for general information,
  6754.                               Call 1-713-524-6394
  6755.  
  6756.                           PsL also has an outstanding
  6757.                           catalog for the Macintosh.
  6758.  
  6759.  
  6760.